mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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.
This commit is contained in:
parent
41ad4dfc04
commit
1d33d53780
5 changed files with 35 additions and 34 deletions
|
@ -9,7 +9,7 @@ get_code_extra_index(PyInterpreterState* interp) {
|
|||
PyObject *interp_dict = PyInterpreterState_GetDict(interp); // borrowed
|
||||
assert(interp_dict); // real users would handle missing dict... somehow
|
||||
|
||||
PyObject *index_obj = PyDict_GetItemString(interp_dict, key); // borrowed
|
||||
PyObject *index_obj = _PyDict_GetItemStringWithError(interp_dict, key); // borrowed
|
||||
Py_ssize_t index = 0;
|
||||
if (!index_obj) {
|
||||
if (PyErr_Occurred()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue