diff options
| author | Victor Stinner <vstinner@python.org> | 2022-11-10 23:58:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-10 23:58:07 +0100 |
| commit | 3a1dde8f29215418ec4e27fd6234cfa19a5407c6 (patch) | |
| tree | 433d4efb6105ded7a5abcc0f96360731840b10aa /Objects/moduleobject.c | |
| parent | 1960eb005e04b7ad8a91018088cfdb0646bc1ca0 (diff) | |
| download | cpython-git-3a1dde8f29215418ec4e27fd6234cfa19a5407c6.tar.gz | |
gh-99300: Use Py_NewRef() in Objects/ directory (#99354)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Objects/ directory.
Diffstat (limited to 'Objects/moduleobject.c')
| -rw-r--r-- | Objects/moduleobject.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index ee8ef7f5b4..a1d09a6e46 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -70,8 +70,7 @@ module_init_dict(PyModuleObject *mod, PyObject *md_dict, if (PyDict_SetItem(md_dict, &_Py_ID(__spec__), Py_None) != 0) return -1; if (PyUnicode_CheckExact(name)) { - Py_INCREF(name); - Py_XSETREF(mod->md_name, name); + Py_XSETREF(mod->md_name, Py_NewRef(name)); } return 0; @@ -506,8 +505,7 @@ PyModule_GetNameObject(PyObject *m) } return NULL; } - Py_INCREF(name); - return name; + return Py_NewRef(name); } const char * @@ -541,8 +539,7 @@ PyModule_GetFilenameObject(PyObject *m) } return NULL; } - Py_INCREF(fileobj); - return fileobj; + return Py_NewRef(fileobj); } const char * |
