summaryrefslogtreecommitdiffstats
path: root/Modules/_gdbmmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-14 12:08:15 (GMT)
committerGitHub <noreply@github.com>2022-11-14 12:08:15 (GMT)
commit3817607b8a345851e4fa436747a346890ced33f1 (patch)
treebe135083ae53cef88b2187a5470cff46c68110ef /Modules/_gdbmmodule.c
parentdb115682bd639a2642c617f0b7d5b30cd7d7f472 (diff)
downloadcpython-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.c6
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 *