Skip to content

Commit 8f03290

Browse files
Backwards compability for Python 2 64bit
1 parent c701878 commit 8f03290

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Diff for: pyswip/easy.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,18 @@
2323
# SOFTWARE.
2424

2525

26+
import sys
27+
2628
from pyswip.core import *
2729

2830

31+
# For backwards compability with Python 2 64bit
32+
if sys.version_info < (3,):
33+
integer_types = (int, long,)
34+
else:
35+
integer_types = (int,)
36+
37+
2938
class InvalidTypeError(TypeError):
3039
def __init__(self, *args):
3140
type_ = args and args[0] or "Unknown"
@@ -67,7 +76,7 @@ def fromTerm(cls, term):
6776

6877
if isinstance(term, Term):
6978
term = term.handle
70-
elif not isinstance(term, (c_void_p, int)):
79+
elif not isinstance(term, (c_void_p, integer_types)):
7180
raise ArgumentTypeError((str(Term), str(c_void_p)), str(type(term)))
7281

7382
a = atom_t()
@@ -266,7 +275,7 @@ def fromTerm(cls, term):
266275

267276
if isinstance(term, Term):
268277
term = term.handle
269-
elif not isinstance(term, (c_void_p, int)):
278+
elif not isinstance(term, (c_void_p, integer_types)):
270279
raise ArgumentTypeError((str(Term), str(int)), str(type(term)))
271280

272281
f = functor_t()

0 commit comments

Comments
 (0)