Skip to content
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

PyDict_GetItem and PyObject_HasAttr should not be used #106033

Closed
serhiy-storchaka opened this issue Jun 23, 2023 · 3 comments
Closed

PyDict_GetItem and PyObject_HasAttr should not be used #106033

serhiy-storchaka opened this issue Jun 23, 2023 · 3 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Jun 23, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jun 23, 2023
…bject_HasAttr

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code.
serhiy-storchaka added a commit that referenced this issue Jun 23, 2023
…HasAttr (GH-106034)

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jun 23, 2023
…and PyObject_HasAttr (pythonGH-106034)

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code..
(cherry picked from commit 1d33d53)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jun 23, 2023
…and PyObject_HasAttr (pythonGH-106034)

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code.
(cherry picked from commit 1d33d53)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jun 23, 2023
gpshead added a commit that referenced this issue Jun 24, 2023
Use a note:: tag so that these dict and object API deficiencies show up clearly.

A caution:: tag was considered, but our current python docs rendering doesn't do much with that (no box or color change).  warning:: seemed too extreme.  note looks good.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 24, 2023
…nGH-106047)

Use a note:: tag so that these dict and object API deficiencies show up clearly.

A caution:: tag was considered, but our current python docs rendering doesn't do much with that (no box or color change).  warning:: seemed too extreme.  note looks good.
(cherry picked from commit 19d6511)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 24, 2023
…nGH-106047)

Use a note:: tag so that these dict and object API deficiencies show up clearly.

A caution:: tag was considered, but our current python docs rendering doesn't do much with that (no box or color change).  warning:: seemed too extreme.  note looks good.
(cherry picked from commit 19d6511)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead added a commit that referenced this issue Jun 24, 2023
…06047) (#106071)

gh-106033: [docs] Improve C API GetItem & HasAttr notes. (GH-106047)

Use a note:: tag so that these dict and object API deficiencies show up clearly.

A caution:: tag was considered, but our current python docs rendering doesn't do much with that (no box or color change).  warning:: seemed too extreme.  note looks good.
(cherry picked from commit 19d6511)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead added a commit that referenced this issue Jun 24, 2023
…06047) (#106070)

gh-106033: [docs] Improve C API GetItem & HasAttr notes. (GH-106047)

Use a note:: tag so that these dict and object API deficiencies show up clearly.

A caution:: tag was considered, but our current python docs rendering doesn't do much with that (no box or color change).  warning:: seemed too extreme.  note looks good.
(cherry picked from commit 19d6511)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead pushed a commit that referenced this issue Jun 24, 2023
#106041)

[3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034)

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code.
(cherry picked from commit 1d33d53)
gpshead pushed a commit that referenced this issue Jun 24, 2023
#106040)

[3.11] gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034)

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code..
(cherry picked from commit 1d33d53)
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 29, 2023
…ctor (pythonGH-106044)

(cherry picked from commit 08c08d2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Jun 29, 2023
…uctor (GH-106044) (GH-106228)

gh-106033: Get rid of PyDict_GetItem in _PyFunction_FromConstructor (GH-106044)
(cherry picked from commit 08c08d2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@iritkatriel
Copy link
Member

See also #86172.

@vstinner
Copy link
Member

See also the issue #106004: I propose adding PyDict_GetItemRef() function which doesn't have these flaws.

@erlend-aasland
Copy link
Contributor

Can this be closed, or do you expect more work here, @serhiy-storchaka?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants