-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Replace _pysqlite_long_from_int64() with PyLong_FromLongLong() #16882
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
Replace _pysqlite_long_from_int64() with PyLong_FromLongLong() #16882
Conversation
PyObject * | ||
_pysqlite_long_from_int64(sqlite_int64 value) | ||
{ | ||
# if SIZEOF_LONG_LONG < 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded since long long
is guaranteed to be at least 64-bit.
# 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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but you should be open a issue on bpo to more discussion
No description provided.