Skip to content
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

bpo-41324 Add a minimal decimal capsule API #21519

Merged
merged 21 commits into from Aug 10, 2020
Merged

Conversation

skrah
Copy link
Contributor

@skrah skrah commented Jul 17, 2020

@skrah skrah requested a review from rhettinger as a code owner Jul 17, 2020
@skrah skrah changed the title Add a minimal decimal capsule API bpo-41324 Add a minimal decimal capsule API Jul 17, 2020
@pitrou
Copy link

@pitrou pitrou commented Jul 17, 2020

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

@pitrou
Copy link

@pitrou 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)).

Include/decimal.h Outdated Show resolved Hide resolved
@skrah
Copy link
Author

@skrah 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).

Doc/c-api/decimal.rst Outdated Show resolved Hide resolved
@skrah skrah removed the skip news label Aug 10, 2020
@skrah skrah merged commit 39042e0 into python:master Aug 10, 2020
10 checks passed
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Aug 10, 2020

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

@skrah skrah deleted the minimal_decimal_api branch Aug 10, 2020
shihai1991 pushed a commit to shihai1991/cpython that referenced this issue Aug 20, 2020
xzy3 pushed a commit to xzy3/cpython that referenced this issue Oct 18, 2020
chrisburr pushed a commit to chrisburr/cpython that referenced this issue Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants