Modify python version check such that linters recognize it
This commit is contained in:
parent
3691e33a0f
commit
a7ba97b065
@ -8,7 +8,7 @@ from .unicorn_const import (
|
||||
|
||||
__version__ = "%u.%u.%u" % (__MAJOR, __MINOR, __PATCH)
|
||||
|
||||
if _sys.version_info.major == 2:
|
||||
from .unicorn_py2 import *
|
||||
else:
|
||||
if _sys.version_info >= (3,):
|
||||
from .unicorn_py3 import *
|
||||
else:
|
||||
from .unicorn_py2 import *
|
||||
|
@ -23,8 +23,7 @@ ucsubclass = 0
|
||||
if not hasattr(sys.modules[__name__], "__file__"):
|
||||
__file__ = inspect.getfile(inspect.currentframe())
|
||||
|
||||
_python2 = sys.version_info[0] < 3
|
||||
if _python2:
|
||||
if sys.version_info < (3,):
|
||||
range = xrange
|
||||
|
||||
_lib = { 'darwin': 'libunicorn.2.dylib',
|
||||
@ -55,7 +54,7 @@ def _load_win_support(path):
|
||||
ctypes.cdll.LoadLibrary(lib_file)
|
||||
#print('SUCCESS')
|
||||
_loaded_windows_dlls.add(dll)
|
||||
except OSError as e:
|
||||
except OSError:
|
||||
#print('FAIL to load %s' %lib_file, e)
|
||||
continue
|
||||
|
||||
@ -72,7 +71,7 @@ def _load_lib(path):
|
||||
dll = ctypes.cdll.LoadLibrary(lib_file)
|
||||
#print('SUCCESS')
|
||||
return dll
|
||||
except OSError as e:
|
||||
except OSError:
|
||||
#print('FAIL to load %s' %lib_file, e)
|
||||
return None
|
||||
|
||||
|
@ -104,7 +104,7 @@ def __load_uc_lib() -> ctypes.CDLL:
|
||||
# - global load
|
||||
# - python's lib directory
|
||||
|
||||
if sys.version_info.minor >= 12:
|
||||
if sys.version_info >= (3, 12):
|
||||
from importlib import resources
|
||||
|
||||
canonicals = resources.files('unicorn') / 'lib'
|
||||
|
@ -9,7 +9,7 @@ from unicorn import *
|
||||
from unicorn.x86_const import *
|
||||
|
||||
|
||||
if sys.version_info.major == 2:
|
||||
if sys.version_info < (3,):
|
||||
range = xrange
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user