gh-149083: Convert some private and simple sentinels to PEP 661#149084
gh-149083: Convert some private and simple sentinels to PEP 661#149084JelleZijlstra wants to merge 4 commits intopython:mainfrom
Conversation
picnixz
left a comment
There was a problem hiding this comment.
There is a sentinel in hashlib.py to detect usage of arguments and raise appropriate warnings/errors so could you also update it? it's a hacky code because I needed to mirror the C behavior in some sense.
picnixz
left a comment
There was a problem hiding this comment.
In dataclasses, there is also _FIELD, _FIELD_CLASSVAR and _FIELD_INITVAR that you could update I think?
|
I was going to leave those dataclasses objects alone since they're instances of a common class, and I wouldn't be able to preserve that behavior. |
|
|
|
|
||
|
|
||
| UNNAMED_SECTION = _UnnamedSection() | ||
| UNNAMED_SECTION = sentinel("<UNNAMED_SECTION>") |
There was a problem hiding this comment.
This makes it no longer picklable, I'll revert this.
There was a problem hiding this comment.
Maybe we coule have a mechanism for making it pickable by default? or a keyword argument that adds "module."?
There was a problem hiding this comment.
We'd need a keyword argument for the repr() instead, the module is already inferred correctly.
Documentation build overview
71 files changed ·
|
serhiy-storchaka
left a comment
There was a problem hiding this comment.
I think that using names like "", "", etc for sentinels shown in function signatures will more clearly show that the behavior when the argument is not specified differs from the behavior when the argument is specified with any value.
Currently, for functions implemented in Argument Clinic it is shown as <unrepresentable>, but <not specified> would be better in most cases.
Uh oh!
There was an error while loading. Please reload this page.