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

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 April 4, 2022 16:51
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

If you want to schedule another build, you need to add the ":hammer: 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 Outdated Show resolved Hide resolved
@vstinner
Copy link
Member

It seems like this change caused a regression: #91821

@dignissimus
Copy link
Contributor Author

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.

6 participants