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

gh-91291: Accept attributes as keyword arguments in decimal.localcontext #32242

Merged
merged 20 commits into from Apr 22, 2022

Conversation

dignissimus
Copy link
Contributor

@dignissimus dignissimus commented Apr 1, 2022

This allows attributes to be set like this

with decimal.localcontext(prec=10):
    ...

instead of like this

with decimal.localcontext() as ctx:
    ctx.prec = 10
    ...

#91291

https://bugs.python.org/issue47135

Lib/_pydecimal.py Outdated Show resolved Hide resolved
Lib/test/test_decimal.py Show resolved Hide resolved
Doc/library/decimal.rst Show resolved Hide resolved
Modules/_decimal/_decimal.c Outdated Show resolved Hide resolved
@dignissimus
Copy link
Contributor Author

dignissimus commented Apr 4, 2022

Thank you for the review, I'll be able to make the changes later today

Doc/library/decimal.rst Outdated Show resolved Hide resolved
Lib/_pydecimal.py Outdated Show resolved Hide resolved
Lib/_pydecimal.py Outdated Show resolved Hide resolved
dignissimus and others added 4 commits Apr 4, 2022
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@dignissimus dignissimus requested a review from JelleZijlstra Apr 13, 2022
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Looks good apart from one nit which I'll apply myself. Then I'll also run this through the buildbots in case there's a refleak.

Modules/_decimal/_decimal.c Outdated Show resolved Hide resolved
@JelleZijlstra JelleZijlstra changed the title bpo-47135: Accept attributes as keyword arguments in decimal.localcontext gh-91291: Accept attributes as keyword arguments in decimal.localcontext Apr 14, 2022
@JelleZijlstra JelleZijlstra added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 14, 2022
@bedevere-bot
Copy link

bedevere-bot commented Apr 14, 2022

🤖 New build scheduled with the buildbot fleet by @JelleZijlstra for commit df3ab57 🤖

If you want to schedule another build, you need to add the "🔨 test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 14, 2022
Lib/_pydecimal.py Show resolved Hide resolved
Lib/_pydecimal.py Outdated Show resolved Hide resolved
@JelleZijlstra JelleZijlstra self-assigned this Apr 21, 2022
@JelleZijlstra JelleZijlstra merged commit bcf14ae into python:main Apr 22, 2022
13 checks passed
@vstinner
Copy link
Member

vstinner commented Apr 22, 2022

It seems like this change caused a regression: #91821

@dignissimus
Copy link
Contributor Author

dignissimus commented Apr 22, 2022

Oh, interesting. I'll try and work out where the issue is.

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.

None yet

6 participants