[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

Sam Ezeh report at bugs.python.org
Fri Apr 1 14:59:49 EDT 2022


Sam Ezeh <sam.z.ezeh at gmail.com> added the comment:

I'm looking into adding this

> Seems reasonable to me, but I think a full implementation would want to throw an error for keyword args that don't already exist as context attributes (otherwise typos would fail silently)

For _pydecimal, I think this would automatically happen automatically as Context.__setattr__ raises AttributeError when it's passed a name that isn't a context attribute.

For _decimal this can be done with keyword arguments and `PyArg_ParseTupleAndKeywords`.

----------
nosy: +sam_ezeh

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47135>
_______________________________________


More information about the Python-bugs-list mailing list