Skip to content

convert from long long to PyLong losslessly - #1106

Merged
vstinner merged 1 commit into
masterfrom
benjamin-long-long-timeval
Apr 13, 2017
Merged

vstinner merged 1 commit into
masterfrom
benjamin-long-long-timeval

Conversation

@benjaminp

Copy link
Copy Markdown
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 Apr 13, 2017
@serhiy-storchaka

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

4 participants