Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backwards compability for Python 2 64bit #104

Merged
merged 2 commits into from
Oct 3, 2020
Merged

Conversation

tobiasgrubenmann
Copy link

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).

@tobiasgrubenmann tobiasgrubenmann force-pushed the master branch 2 times, most recently from d6cfabf to 263c2a8 Compare September 13, 2020 16:38
@yuce
Copy link
Owner

yuce commented Oct 3, 2020

@tobiasgrubenmann Thanks for your contribution! Could you add your name to CONTRIBUTORS ?

@g-gemignani Do the changes in this PR have any adverse affect on your end?

@g-gemignani
Copy link
Contributor

Hi @yuce I do not see any issue with this PR. :) Thank you for asking!

@yuce yuce merged commit eba2c5d into yuce:master Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants