Repository navigation
Conversation
Sentinel objects can now be given a docstring with `sentinel(name, doc=...)`. The `__doc__` attribute of a sentinel object remains read-only.
Documentation build overview
|
skirpichev
reviewed
Nov 16, 2026
| * :class:`sentinel` now accepts an optional *doc* parameter for giving a | ||
| sentinel object a docstring. The ``__doc__`` attribute of a sentinel | ||
| object is now ``None`` by default, instead of the docstring of the | ||
| :class:`!sentinel` class. |
Member
There was a problem hiding this comment.
Why not this:
Suggested change
| :class:`!sentinel` class. | |
| :class:`sentinel` class. |
?
| @@ -0,0 +1,3 @@ | |||
| Add an optional *doc* parameter to :class:`sentinel` for giving a sentinel | |||
| object a docstring. The ``__doc__`` attribute of a sentinel object is now | |||
| ``None`` by default, instead of the docstring of the :class:`!sentinel` class. | |||
Member
There was a problem hiding this comment.
Same:
Suggested change
| ``None`` by default, instead of the docstring of the :class:`!sentinel` class. | |
| ``None`` by default, instead of the docstring of the :class:`sentinel` class. |
|
|
||
| PyObject *sentinel = sentinel_new_with_module( | ||
| &PySentinel_Type, name_obj, module_obj, repr_obj); | ||
| &PySentinel_Type, name_obj, module_obj, repr_obj, Py_None); |
Member
There was a problem hiding this comment.
Probably we should replace PySentinel_New() with some new PySentinel_NewEx(), having new argument. Or introduce new C-API function to set __doc__ attribute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sentinel objects can now be given a docstring with
sentinel(name, doc=...). The__doc__attribute of a sentinel object remains read-only.docparameter tosentinel#162069