diff options
| author | KyleMiles <krm504@nyu.edu> | 2018-12-22 18:35:24 -0500 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2018-12-22 18:35:24 -0500 |
| commit | b0e3bd2733ee100483b79eb09fd57534f8a80900 (patch) | |
| tree | 12c63bcc59d9c5f974c34d7d8e45e9156d9a1ceb /python | |
| parent | 50f496a87861d5d5688bb9aeecb0b4ab5653dc01 (diff) | |
Python2/3 support
Diffstat (limited to 'python')
| -rw-r--r-- | python/__init__.py | 6 | ||||
| -rw-r--r-- | python/architecture.py | 2 | ||||
| -rw-r--r-- | python/databuffer.py | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/python/__init__.py b/python/__init__.py index d155c331..6e30520b 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -51,6 +51,12 @@ def with_metaclass(meta, *bases): return type.__new__(metaclass, 'temporary_class', (), {}) +try: + long = long +except NameError: + long = int + + def cstr(arg): if isinstance(arg, bytes) or arg is None: return arg diff --git a/python/architecture.py b/python/architecture.py index b5daaa6d..b12b35a1 100644 --- a/python/architecture.py +++ b/python/architecture.py @@ -38,7 +38,7 @@ from binaryninja import callingconvention # 2-3 compatibility from binaryninja import range from binaryninja import with_metaclass - +from binaryninja import long class _ArchitectureMetaClass(type): diff --git a/python/databuffer.py b/python/databuffer.py index 2fb5382d..eeee7ad1 100644 --- a/python/databuffer.py +++ b/python/databuffer.py @@ -25,17 +25,11 @@ from binaryninja import _binaryninjacore as core # 2-3 compatibility from binaryninja import pyNativeStr +from binaryninja import long class DataBuffer(object): def __init__(self, contents="", handle=None): - - # python3 no longer has longs - try: - long - except NameError: - long = int - if handle is not None: self.handle = core.handle_of_type(handle, core.BNDataBuffer) elif isinstance(contents, int) or isinstance(contents, long): |
