mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-99300: Use Py_NewRef() in Python/ directory (#99302)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
This commit is contained in:
parent
f883b7f8ee
commit
d8f239d86e
14 changed files with 41 additions and 80 deletions
|
@ -326,8 +326,7 @@ _PyErr_NormalizeException(PyThreadState *tstate, PyObject **exc,
|
|||
set to NULL.
|
||||
*/
|
||||
if (!value) {
|
||||
value = Py_None;
|
||||
Py_INCREF(value);
|
||||
value = Py_NewRef(Py_None);
|
||||
}
|
||||
|
||||
/* Normalize the exception so that if the type is a class, the
|
||||
|
@ -1287,8 +1286,7 @@ make_unraisable_hook_args(PyThreadState *tstate, PyObject *exc_type,
|
|||
if (exc_type == NULL) { \
|
||||
exc_type = Py_None; \
|
||||
} \
|
||||
Py_INCREF(exc_type); \
|
||||
PyStructSequence_SET_ITEM(args, pos++, exc_type); \
|
||||
PyStructSequence_SET_ITEM(args, pos++, Py_NewRef(exc_type)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue