-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-110527: Improve PySet_Clear
docs
#110528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
da53102
to
2ef1f19
Compare
Doc/c-api/set.rst
Outdated
Empty an existing set of all elements. | ||
Empty an existing set of all elements. Return ``0`` on | ||
success or ``-1`` on failure. Raise :exc:`SystemError` if *set* is not an | ||
instance of :class:`set` or its subtype. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc is quite generic and doesn't explain that it cannot fail if you pass a set type or a subtype of the set type.
It only fails the argument type is not set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, should be better now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@serhiy-storchaka: Do we have to document SystemError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other functions have:
Raise :exc:`SystemError` if *set* is not an instance of :class:`set` or its subtype.
I think the same wording should be used here, until there are good reasons for difference.
I don't have a strong preference between subtype and subclass. Consistent is good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@serhiy-storchaka: I let you decide which phrasing is better for subtypes 😁
(cherry picked from commit bfc1cd8) Co-authored-by: Nikita Sobolev <[email protected]>
(cherry picked from commit bfc1cd8) Co-authored-by: Nikita Sobolev <[email protected]>
GH-110927 is a backport of this pull request to the 3.11 branch. |
GH-110928 is a backport of this pull request to the 3.12 branch. |
Mention that it can return
-1
and raiseSystemError
:cpython/Objects/setobject.c
Lines 2291 to 2298 in 7e30821
PySet_Clear
's docs are incomplete #110527📚 Documentation preview 📚: https://cpython-previews--110528.org.readthedocs.build/