Skip to content

convert from long long to PyLong losslessly #1106

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

Merged
merged 1 commit into from
Apr 13, 2017

Conversation

benjaminp
Copy link
Contributor

The current code can lose precision when sizeof(long) < sizeof(long long).

@benjaminp benjaminp changed the title convert from long long to PyLong loselessly convert from long long to PyLong losslessly Apr 13, 2017
@serhiy-storchaka
Copy link
Member

Is it possible that tv.tv_sec doesn't fit in a long?

The test was added by @Haypo in bpo-22117.

@vstinner vstinner merged commit 2c134c3 into master Apr 13, 2017
@vstinner vstinner deleted the benjamin-long-long-timeval branch April 13, 2017 08:45
@vstinner
Copy link
Member

Having to play with the different C types is painful: the availability and size of each C type depends on the platform, compiler options, etc. See bpo-17870 http://bugs.python.org/issue17870 for adding intmax_t/uintmax_t support :-)

@vstinner
Copy link
Member

IMHO the change fixes a real bug, but it's only a function used for unit tests, so I'm not sure that it's worth it to backport it to 3.6 & 3.5.

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.

4 participants