gh-155051: Reject None keyword arguments in decimal.localcontext() - #155054
Conversation
None is not a valid value for any of the context attributes. The C implementation silently ignored it, because it shared the code with the Context constructor, where None means "not specified". The pure Python implementation always rejected it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| prec: object = NULL | ||
| rounding: object = NULL | ||
| Emin: object = NULL | ||
| Emax: object = NULL | ||
| capitals: object = NULL | ||
| clamp: object = NULL | ||
| flags: object = NULL | ||
| traps: object = NULL |
There was a problem hiding this comment.
As in #155047, this is not rendered well by signature().
There was a problem hiding this comment.
We already use @text_signature "($module, /, ctx=None, **kwargs)" for this method. And the Python implementation has the same signature.
There was a problem hiding this comment.
Yes, there is no regression. Though, I think in future we could use here explicit arguments with a sentinel.
# Conflicts: # Modules/_decimal/_decimal.c # Modules/_decimal/clinic/_decimal.c.h
|
…t() (pythonGH-155054) None is not a valid value for any of the context attributes. The C implementation silently ignored it, because it shared the code with the Context constructor, where None means "not specified". The pure Python implementation always rejected it. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
None is not a valid value for any of the context attributes. The C implementation silently ignored it, because it shared the code with the
Contextconstructor, whereNonemeans "not specified". The pure Python implementation always rejected it.