-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
Add PyFloat_(Pack|Unpack)(2|4|8) to the public C API #91062
Comments
Original issue. msgpack/msgpack-python#497 _PyFloat_(Pack|Unpack)(4|8) is very nice API for serializers like msgpack. And these APIs don't reveal CPython internal strucutre. It just convert double and float into char[]. So please keep these APIs public for libraries like msgpack. |
I disagree. A function should be either fully public: tested, documented. Or fully internal. In the past, many functions were in both, in the gray area. If these functions are useful, please make them *public* and document them. I'm +1 to make these functions public. |
OK. By quick grepping, I found only msgpack and bitstruct use these API. |
I reopen the issue, I would like to make these functions public :-) I searched for the 6 functions moved to the internal C API and I found 6 projets using it in the top 5000 PyPI projects (at 2022-01-26):
The 6 functions are used:
|
The pack/unpack functions have been moved to the internal C API by this change: commit 0a883a7
|
I prepared a pythoncapi_compat PR to provide these functions to Python 3.10 and older: Note: bpo-11734 (commit 7c4e409) added _PyFloat_Pack2() and _PyFloat_Unpack2() to Python 3.6.0b1. |
PR for msgpack: msgpack/msgpack-python#499 |
PR for bitstruct: eerimoq/bitstruct#26 |
zodbpickle issue: zopefoundation/zodbpickle#67 |
msgpack and bitstruct use the newly added functions: my two PRs got merged. msgpack was my main motivation to add these functions :-) Thanks to great reviews, the functions got a new better documentation! I close the issue. Thanks again for reviews! |
_PyFloat_{Pack,Unpack}{4,8}
from internal to cpython #31649Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: