|
23 | 23 | # SOFTWARE.
|
24 | 24 |
|
25 | 25 |
|
| 26 | +import sys |
| 27 | + |
26 | 28 | from pyswip.core import *
|
27 | 29 |
|
28 | 30 |
|
| 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 | + |
29 | 38 | class InvalidTypeError(TypeError):
|
30 | 39 | def __init__(self, *args):
|
31 | 40 | type_ = args and args[0] or "Unknown"
|
@@ -67,7 +76,7 @@ def fromTerm(cls, term):
|
67 | 76 |
|
68 | 77 | if isinstance(term, Term):
|
69 | 78 | term = term.handle
|
70 |
| - elif not isinstance(term, (c_void_p, int)): |
| 79 | + elif not isinstance(term, (c_void_p, integer_types)): |
71 | 80 | raise ArgumentTypeError((str(Term), str(c_void_p)), str(type(term)))
|
72 | 81 |
|
73 | 82 | a = atom_t()
|
@@ -266,7 +275,7 @@ def fromTerm(cls, term):
|
266 | 275 |
|
267 | 276 | if isinstance(term, Term):
|
268 | 277 | term = term.handle
|
269 |
| - elif not isinstance(term, (c_void_p, int)): |
| 278 | + elif not isinstance(term, (c_void_p, integer_types)): |
270 | 279 | raise ArgumentTypeError((str(Term), str(int)), str(type(term)))
|
271 | 280 |
|
272 | 281 | f = functor_t()
|
|
0 commit comments