GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() by vstinner · Pull Request #120390 · python/cpython Conversation
|
|
This PR is now ready for review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PyLong_ToUInt32() and PyLong_ToUInt64() can now use the __index__() method if the object has the method.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would like it if we don't have to have docs like "like this other function", but if that's the best we can do then I'll survive.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I grouped functions by pairs in the documentation. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
The formatting in the docs preview looks good 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Calling |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This PR doesn't change PyLong_AsUnsignedLong(). Are you referring to code replacing PyLong_AsUnsignedLong() with one of these functions?
For me, it's strange that signed and unsigned integers are treated diffferently. I would like to treat them the same. The GIL issue can be mentioned in the doc? For example:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I created capi-workgroup/decisions#32 "Add PyLong_FromInt64() and PyLong_ToInt64()" in the C API WG Decisions project. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| PyModule_AddObject(m, "INT32_MIN", PyLong_FromInt32(INT32_MIN)); | ||
| PyModule_AddObject(m, "INT32_MAX", PyLong_FromInt32(INT32_MAX)); | ||
| PyModule_AddObject(m, "UINT32_MAX", PyLong_FromUInt32(UINT32_MAX)); | ||
| PyModule_AddObject(m, "INT64_MIN", PyLong_FromInt64(INT64_MIN)); | ||
| PyModule_AddObject(m, "INT64_MAX", PyLong_FromInt64(INT64_MAX)); | ||
| PyModule_AddObject(m, "UINT64_MAX", PyLong_FromUInt64(UINT64_MAX)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. You can define them in the Python code as INT32_MAX = 2**31 - 1 etc.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I prefer to reuse <limits.h> C constants to avoid any typo.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@serhiy-storchaka @zooba @encukou: Would you mind to review the updated PR? I updated the PR to the API approved the C API WG. It now uses the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but check_long_asunsignedint is now superseded by check_long_asint.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Reuse check_long_asint().
I removed check_long_asunsignedint() to reuse check_long_asint(). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.