You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
decimal.localcontext() ignores None keyword arguments in the C implementation #155051
localcontext() accepts keyword arguments which set the corresponding attributes of the new context. The C and the pure Python implementations differ if the value is None:
>>> import decimal, _pydecimal
>>> with decimal.localcontext(prec=None) as ctx: ctx.prec
...
28
>>> with _pydecimal.localcontext(prec=None) as ctx: ctx.prec
...
TypeError: prec must be an integer
The C implementation shares the code with the Context constructor, where None means "not specified"; the pure Python implementation simply assigns all keyword arguments. None is not a valid value for any of these attributes, so it should probably be rejected in both.
Activity
gh-155051: Reject None keyword arguments in decimal.localcontext() (G…
pythongh-155051: Reject None keyword arguments in decimal.localcontex…