Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-106033: [docs] Improve C API GetItem & HasAttr notes.#106047
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
Merged
+23
−14
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f7083f2
[docs] Improve C API GetItem & HasAttr notes.
gpshead 1e2d961
~object.
gpshead e4c34f2
more ~object.
gpshead 8c15463
caution rather than note
gpshead 1840e2b
caution rather than note
gpshead 97ead38
~object
gpshead b83c9a2
~object
gpshead 702ff45
~object
gpshead cfa054b
Update Doc/c-api/dict.rst
gpshead 42beeb4
Update Doc/c-api/dict.rst
gpshead b24b019
Update Doc/c-api/dict.rst
gpshead 302c387
Update Doc/c-api/dict.rst
gpshead badc027
Update Doc/c-api/object.rst
gpshead 9aa6924
back to note
gpshead 76d43ef
back to note
gpshead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -98,9 +98,11 @@ Dictionary Objects | ||
| Return the object from dictionary *p* which has a key *key*. Return ``NULL`` | ||
| if the key *key* is not present, but *without* setting an exception. | ||
| Note that exceptions which occur while calling :meth:`__hash__` and | ||
| :meth:`__eq__` methods will get suppressed. | ||
| To get error reporting use :c:func:`PyDict_GetItemWithError()` instead. | ||
| .. note:: | ||
| Exceptions that occur while this calls :meth:`~object.__hash__` and | ||
| :meth:`~object.__eq__` methods are silently ignored. | ||
| Prefer the :c:func:`PyDict_GetItemWithError` function instead. | ||
| .. versionchanged:: 3.10 | ||
| Calling this API without :term:`GIL` held had been allowed for historical | ||
| @@ -120,10 +122,13 @@ Dictionary Objects | ||
| This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a | ||
| :c:expr:`const char*`, rather than a :c:expr:`PyObject*`. | ||
| Note that exceptions which occur while calling :meth:`__hash__` and | ||
| :meth:`__eq__` methods and creating a temporary string object | ||
| will get suppressed. | ||
| To get error reporting use :c:func:`PyDict_GetItemWithError()` instead. | ||
| .. note:: | ||
gpshead marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Exceptions that occur while this calls :meth:`~object.__hash__` and | ||
| :meth:`~object.__eq__` methods or while creating the temporary :class:`str` | ||
| object are silently ignored. | ||
| Prefer using the :c:func:`PyDict_GetItemWithError` function with your own | ||
| :c:func:`PyUnicode_FromString` *key* instead. | ||
| .. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *defaultobj) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -33,9 +33,11 @@ Object Protocol | ||
| is equivalent to the Python expression ``hasattr(o, attr_name)``. This function | ||
| always succeeds. | ||
| Note that exceptions which occur while calling :meth:`__getattr__` and | ||
| :meth:`__getattribute__` methods will get suppressed. | ||
| To get error reporting use :c:func:`PyObject_GetAttr()` instead. | ||
| .. note:: | ||
gpshead marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Exceptions that occur when this calls :meth:`~object.__getattr__` and | ||
| :meth:`~object.__getattribute__` methods are silently ignored. | ||
| For proper error handling, use :c:func:`PyObject_GetAttr` instead. | ||
| .. c:function:: int PyObject_HasAttrString(PyObject *o, const char *attr_name) | ||
| @@ -44,10 +46,12 @@ Object Protocol | ||
| is equivalent to the Python expression ``hasattr(o, attr_name)``. This function | ||
| always succeeds. | ||
| Note that exceptions which occur while calling :meth:`__getattr__` and | ||
| :meth:`__getattribute__` methods and creating a temporary string object | ||
| will get suppressed. | ||
| To get error reporting use :c:func:`PyObject_GetAttrString()` instead. | ||
| .. note:: | ||
gpshead marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Exceptions that occur when this calls :meth:`~object.__getattr__` and | ||
| :meth:`~object.__getattribute__` methods or while creating the temporary :class:`str` | ||
| object are silently ignored. | ||
| For proper error handling, use :c:func:`PyObject_GetAttrString` instead. | ||
| .. c:function:: PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name) | ||
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.
Uh oh!
There was an error while loading. Please reload this page.