mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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
|
@ -798,8 +798,7 @@ pycore_init_builtins(PyThreadState *tstate)
|
|||
if (builtins_dict == NULL) {
|
||||
goto error;
|
||||
}
|
||||
Py_INCREF(builtins_dict);
|
||||
interp->builtins = builtins_dict;
|
||||
interp->builtins = Py_NewRef(builtins_dict);
|
||||
|
||||
PyObject *isinstance = PyDict_GetItem(builtins_dict, &_Py_ID(isinstance));
|
||||
assert(isinstance);
|
||||
|
@ -2289,8 +2288,7 @@ create_stdio(const PyConfig *config, PyObject* io,
|
|||
goto error;
|
||||
}
|
||||
else {
|
||||
raw = buf;
|
||||
Py_INCREF(raw);
|
||||
raw = Py_NewRef(buf);
|
||||
}
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
|
@ -2552,8 +2550,7 @@ _Py_FatalError_PrintExc(PyThreadState *tstate)
|
|||
|
||||
_PyErr_NormalizeException(tstate, &exception, &v, &tb);
|
||||
if (tb == NULL) {
|
||||
tb = Py_None;
|
||||
Py_INCREF(tb);
|
||||
tb = Py_NewRef(Py_None);
|
||||
}
|
||||
PyException_SetTraceback(v, tb);
|
||||
if (exception == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue