Skip to content

bpo-41324 Add a minimal decimal capsule API #21519

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

Merged
merged 21 commits into from
Aug 10, 2020

Conversation

skrah
Copy link
Contributor

@skrah skrah commented Jul 17, 2020

@pitrou
Copy link
Member

pitrou commented Jul 17, 2020

Also cc @xhochy just in case he's interested in this.

@pitrou
Copy link
Member

pitrou commented Jul 17, 2020

Thank you @skrah for this. AFAICT, the API here would be enough for explicitly-typed conversion.

For type inference (I'm not sure that would make sense, but perhaps) there would ideally be an additional API to get the number of digits in a Decimal (that is, len(dec.as_tuple().digits)).

@skrah
Copy link
Contributor Author

skrah commented Jul 17, 2020

For type inference (I'm not sure that would make sense, but perhaps) there would ideally be an additional API to get the number of digits in a Decimal (that is, len(dec.as_tuple().digits)).

That's a good point. Initially I thought people would use PyDec_Get(v)->digits, but then you need to include
mpdecimal.h. So actually we have two APIs: One for the people who use libmpdec directly and the easier
one. It would make sense to add PyDec_GetDigits(v).

@bedevere-bot
Copy link

@skrah: Please replace # with GH- in the commit message next time. Thanks!

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Aug 20, 2020
xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants