diff --git a/pyswip/easy.py b/pyswip/easy.py index 4cf9a9a..fa470fe 100644 --- a/pyswip/easy.py +++ b/pyswip/easy.py @@ -23,9 +23,18 @@ # SOFTWARE. +import sys + from pyswip.core import * +# For backwards compability with Python 2 64bit +if sys.version_info < (3,): + integer_types = (int, long,) +else: + integer_types = (int,) + + class InvalidTypeError(TypeError): def __init__(self, *args): type_ = args and args[0] or "Unknown" @@ -67,7 +76,7 @@ def fromTerm(cls, term): if isinstance(term, Term): term = term.handle - elif not isinstance(term, (c_void_p, int)): + elif not isinstance(term, (c_void_p, integer_types)): raise ArgumentTypeError((str(Term), str(c_void_p)), str(type(term))) a = atom_t() @@ -266,7 +275,7 @@ def fromTerm(cls, term): if isinstance(term, Term): term = term.handle - elif not isinstance(term, (c_void_p, int)): + elif not isinstance(term, (c_void_p, integer_types)): raise ArgumentTypeError((str(Term), str(int)), str(type(term))) f = functor_t() diff --git a/tests/test_examples.py b/tests/test_examples.py index 9109010..338a912 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -280,5 +280,5 @@ def test_sudoku(self): def example_path(path): import os.path - return os.path.normpath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "..", "examples", path)) + return os.path.normpath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "..", "examples", path)).replace("\\", "\\\\")