Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-131885: Use positional-only markers for the decimal module#131990
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
donbarbos commented Apr 1, 2025 • edited by skirpichev
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by skirpichev
Uh oh!
There was an error while loading. Please reload this page.
/ for decimal.Context methods docs/ for decimal.Context methods
skirpichev left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that signatures for pure-Python versions differ wrt C-coded extension:
>>> import _decimal, _pydecimal >>> help(_decimal.getcontext().plus) Help on built-in function plus: plus(x, /) method of decimal.Context instance Plus corresponds to the unary prefix plus operator in Python, but applies the context to the result. >>> help(_pydecimal.getcontext().plus) Help on method plus: plus(a) method of decimal.Context instance Plus corresponds to unary prefix plus in Python. The operation is evaluated using the same rules as add; the operation plus(a) is calculated as add('0', a) where the '0' has the same exponent as the operand. >>> ExtendedContext.plus(Decimal('1.3')) Decimal('1.3') >>> ExtendedContext.plus(Decimal('-1.3')) Decimal('-1.3') >>> ExtendedContext.plus(-1) Decimal('-1') If we are going to add slashes - pure-Python version should be fixed. Or vice-versa.
donbarbos commented Apr 2, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
although I'm not a fan of using and I think here we will need ping more core members |
This comment was marked as resolved.
This comment was marked as resolved.
skirpichev commented Aug 13, 2025
Sorry for a delay, it's look ok for me. Would you like to fix the rest of the decimal sphinx docs in another pr? |
donbarbos commented Aug 13, 2025
Sorry, but I don't understand what you mean by "rest of the decimal sphinx docs". Do you mean some new functions like |
skirpichev commented Aug 13, 2025
For example, setcontext() function: >>> import _decimal, _pydecimal, inspect >>> inspect.signature(_decimal.setcontext) <Signature (context, /)> >>> inspect.signature(_pydecimal.setcontext) <Signature (context)>You should also check Decimal methods. |
/ for decimal.Context methods/ in decimal moduledonbarbos commented Aug 13, 2025
I also thought that there is a lot of For example, |
skirpichev commented Aug 13, 2025
Sphinx docs don't include self arguments, so we omit leading |
skirpichev left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think all is fixed.
There is an odd description of the round() builtin, but it probably should be fixed separately.
donbarbos commented Aug 13, 2025
Thank you for review |
/ in decimal moduledecimal module043f251 into python:mainUh oh!
There was an error while loading. Please reload this page.
Thanks @donbarbos for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…le (pythonGH-131990) (cherry picked from commit 043f251) Co-authored-by: Semyon Moroz <donbarbos@proton.me>
Sorry, @donbarbos and @AA-Turner, I could not cleanly backport this to |
GH-137902 is a backport of this pull request to the 3.14 branch. |
GH-137904 is a backport of this pull request to the 3.13 branch. |
…`` module (pythonGH-131990) (cherry picked from commit 043f251) Co-authored-by: Semyon Moroz <donbarbos@proton.me>
also noticed a missing default value
num='0'forcreate_decimal*and/as needed #131885📚 Documentation preview 📚: https://cpython-previews--131990.org.readthedocs.build/en/131990/library/decimal.html#decimal-objects