diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-14 12:08:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 12:08:15 (GMT) |
commit | 3817607b8a345851e4fa436747a346890ced33f1 (patch) | |
tree | be135083ae53cef88b2187a5470cff46c68110ef /Modules/_gdbmmodule.c | |
parent | db115682bd639a2642c617f0b7d5b30cd7d7f472 (diff) | |
download | cpython-3817607b8a345851e4fa436747a346890ced33f1.zip cpython-3817607b8a345851e4fa436747a346890ced33f1.tar.gz cpython-3817607b8a345851e4fa436747a346890ced33f1.tar.bz2 |
gh-99300: Use Py_NewRef() in Modules/ directory (#99466)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in test C files of the Modules/ directory.
Diffstat (limited to 'Modules/_gdbmmodule.c')
-rw-r--r-- | Modules/_gdbmmodule.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c index a96d323..e8469da 100644 --- a/Modules/_gdbmmodule.c +++ b/Modules/_gdbmmodule.c @@ -256,8 +256,7 @@ _gdbm_gdbm_get_impl(gdbmobject *self, PyObject *key, PyObject *default_value) res = gdbm_subscript(self, key); if (res == NULL && PyErr_ExceptionMatches(PyExc_KeyError)) { PyErr_Clear(); - Py_INCREF(default_value); - return default_value; + return Py_NewRef(default_value); } return res; } @@ -566,8 +565,7 @@ _gdbm_gdbm_sync_impl(gdbmobject *self, PyTypeObject *cls) static PyObject * gdbm__enter__(PyObject *self, PyObject *args) { - Py_INCREF(self); - return self; + return Py_NewRef(self); } static PyObject * |