convert from long long to PyLong losslessly by benjaminp · Pull Request #1106 · python/cpython

Skip to content

Navigation Menu

Sign in

Appearance settings

Conversation

@benjaminp

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

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

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

@vstinner vstinner deleted the benjamin-long-long-timeval branch

April 13, 2017 08:45

@vstinner

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

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.

benjaminp added a commit that referenced this pull request

Apr 13, 2017

benjaminp added a commit that referenced this pull request

Apr 13, 2017

@ssbr ssbr mannequin mentioned this pull request

Nov 28, 2023