Replace _pysqlite_long_from_int64() with PyLong_FromLongLong()#16882
Merged
serhiy-storchaka merged 1 commit intoOct 23, 2019
Conversation
sir-sigurd
commented
Oct 22, 2019
| PyObject * | ||
| _pysqlite_long_from_int64(sqlite_int64 value) | ||
| { | ||
| # if SIZEOF_LONG_LONG < 8 |
Contributor
Author
There was a problem hiding this comment.
Unneeded since long long is guaranteed to be at least 64-bit.
sir-sigurd
commented
Oct 22, 2019
Comment on lines
-115
to
-119
| # if SIZEOF_LONG < SIZEOF_LONG_LONG | ||
| if (value > LONG_MAX || value < LONG_MIN) | ||
| return PyLong_FromLongLong(value); | ||
| # endif | ||
| return PyLong_FromLong(Py_SAFE_DOWNCAST(value, sqlite_int64, long)); |
Contributor
Author
There was a problem hiding this comment.
I don't think that using PyLong_FromLong() for small values on 32 bit platforms provides speed-up, but if it does that should be done in PyLong_FromLongLong().
Moreover AFAIK long is 32 bit on 64 bit Windows, so that condition is not compiled out.
eamanu
reviewed
Oct 22, 2019
eamanu
left a comment
Contributor
There was a problem hiding this comment.
LGTM but you should be open a issue on bpo to more discussion
serhiy-storchaka
approved these changes
Oct 23, 2019
jacobneiltaylor
pushed a commit
to jacobneiltaylor/cpython
that referenced
this pull request
Dec 5, 2019
shihai1991
pushed a commit
to shihai1991/cpython
that referenced
this pull request
Jan 31, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.