-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-101944: mistake in documentation for PyModule_AddObjectRef()
#101957
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
Changes from all commits
6f8a756
16c5efa
9cc9af3
52ecce5
a7b7a73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -449,10 +449,11 @@ state: | |
Add an object to *module* as *name*. This is a convenience function which | ||
can be used from the module's initialization function. | ||
|
||
On success, return ``0``. On error, raise an exception and return ``-1``. | ||
On success, return ``0``. | ||
|
||
Return ``NULL`` if *value* is ``NULL``. It must be called with an exception | ||
raised in this case. | ||
If *value* is ``NULL`` (indicating failure), raise an exception and return | ||
``-1``. If an exception is set, raise that exception. If no exception is | ||
set, raise :exc:`SystemError`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This documentation sounds misleading to me. The normal case when value is NULL is that an exception is already set, so the function does not "raise an exception". Also, I dislike documenting the exact exception type for implementation details: please don't document "SystemError". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That was my fault; I encouraged it in #101957 (comment). Sorry 'bout that! |
||
|
||
Example usage:: | ||
|
||
|
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.
Please keep this general statement. There are many cases where the function can fail. For example, if mod is not a module or has no dictionary. PyDict_SetItemString() can fail with MemoryError, etc.