summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-16 17:34:24 (GMT)
committerGitHub <noreply@github.com>2022-11-16 17:34:24 (GMT)
commit8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b (patch)
tree510409237622aa30dfc6833602bdde97c578f2bb /Python/import.c
parent19c1462e8dca3319c8290e2edcce482bd18cb018 (diff)
downloadcpython-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.zip
cpython-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.tar.gz
cpython-8211cf5d287acfd815b6a7f6471cdf83dcd2bb9b.tar.bz2
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)
Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index c12b3e0..ab42672 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -625,8 +625,7 @@ import_add_module(PyThreadState *tstate, PyObject *name)
PyObject *m;
if (PyDict_CheckExact(modules)) {
- m = PyDict_GetItemWithError(modules, name);
- Py_XINCREF(m);
+ m = Py_XNewRef(PyDict_GetItemWithError(modules, name));
}
else {
m = PyObject_GetItem(modules, name);