-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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 a minimal decimal capsule API #85496
Comments
This adds a minimal decimal capsule API. As can be seen from the patch, That said, some functions are really necessary:
Antoine, could you verify that this is sufficient for the database use case? |
Also as a note for Mark and Raymond: This API is for exact conversions I'll add documentation once Antoine has tried it out for his use case. |
Adding Daniele Varrazzo, in case this is useful for the PostgreSQL |
I probably won't try it out explicitly (it's basically cumbersome for us to test with non-release Pythons, because of our dependencies to Numpy and Cython), but reviewing the API should be enough anyway. |
It looks like the API would be usable, so the PR now has documentation. |
I'm happy with the API, except that --with-system-libmpdec is naturally Antoine has looked at the API. If anyone else has requests or objections, mpd_uint128_triple_t PyDec_AsUint128Triple(const PyObject *dec) |
Was expanding the C-API discussed on the mailing list or in any wider forum? It seems vstinner is working hard to reduce the public API exposure while this issue + PR makes it even larger. Please reconsider putting this in for 3.10. |
For the record, this is going to be reverted at Stefan's request in bpo-43422. |
FYI, will try to use this API in psycopg3, which supports the PostgreSQL decimal binary format. Thank you very much: it seems exactly what needed. Binary conversion with Python Decimal currently has disappointing performances and is slower than the text format conversion. This is likely caused by the use of Decimal.as_tuple(), which creates tuples for the return value and the digits and requires Python calls to access their values. I have considered using libmpdec directly: personally I wouldn't be opposed to that, but the additional dependency on libmpdec-dev would earn the project no new fan :\ Ref. psycopg/psycopg#54 |
Ah, just noticed that this has been now reverted. Oh well, I'll see what to do then :( |
Note: 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: