Skip to content

bpo-41324 Add a minimal decimal capsule API#21519

Merged
skrah merged 21 commits intopython:masterfrom
skrah:minimal_decimal_api
Aug 10, 2020
Merged

bpo-41324 Add a minimal decimal capsule API#21519
skrah merged 21 commits intopython:masterfrom
skrah:minimal_decimal_api

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