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

wx.ConfigBase.ReadInt() returns long not int #384

Closed
niki-sp opened this Issue Jun 7, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@niki-sp
Copy link

niki-sp commented Jun 7, 2017

wx.ConfigBase.ReadInt() returns long. In wxClassic return type is int.
Is this change intentional?

@RobinD42

This comment has been minimized.

Copy link
Member

RobinD42 commented Jun 8, 2017

No, but it looks like it is just a side-effect of switching from SWIG to SIP. SWIG uses PyInt_FromLong to convert the C long return value, and SIP uses PyLong_FromLong. in Python3 the PyInt_ APIs no longer exist because longs and ints are basically the same, or at least more tightly coupled, so using PyLong_FromLong is certainly the best way to handle it there. In Python 2.7 they are still separate types so the results are different, but does it actually cause any trouble?

@niki-sp

This comment has been minimized.

Copy link

niki-sp commented Jun 9, 2017

I would not find this if it did not cause trouble :-)
Saving configuration for C++ modules requires exact types.
Workaround int(cfg.ReadInt()) handles out of range values too (keeps long long in py2.7)

Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(2**99)
633825300114114700748351602688L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment