Backwards compability for Python 2 64bit #104
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I discovered a problem when running pyswip on Python 2.7. I get the following error:
pyswip.easy.ArgumentTypeError: Expected an argument of type '("<class 'pyswip.easy.Term'>", "<type 'int'>")' but got '<type 'long'>
This problem is also discussed in #40 but the proposed solution is not working, in my case.
I'm running Python 2.7 64bit in combination with SWI-Prolog 64 bit. The problem seems that the integers from the 64bit native library are represented as long in Python 2.7. This is not a problem in Python 3, as int and long are combined in one common datatype.
The workaround for backwards compatibility is adapted from http://python3porting.com/differences.html
I tested the code with 64bit SWI Prolog 8.2.1 on both Python 2.7.16 (64bit) and Python 3.8.3 (64bit).