summaryrefslogtreecommitdiffstats
path: root/PC/winreg.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-18 20:59:53 (GMT)
committerGitHub <noreply@github.com>2023-07-18 20:59:53 (GMT)
commita293fa5915c21b21f5cb8ed9649fbdb37b4c1421 (patch)
tree4d7ca05e79dad8e2e21024896fb7e5c17624e70b /PC/winreg.c
parent40f3f11a773b854c6d94746aa3b1881c8ac71b0f (diff)
downloadcpython-a293fa5915c21b21f5cb8ed9649fbdb37b4c1421.zip
cpython-a293fa5915c21b21f5cb8ed9649fbdb37b4c1421.tar.gz
cpython-a293fa5915c21b21f5cb8ed9649fbdb37b4c1421.tar.bz2
gh-86493: Use PyModule_Add() instead of PyModule_AddObjectRef() (GH-106860)
Diffstat (limited to 'PC/winreg.c')
-rw-r--r--PC/winreg.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/PC/winreg.c b/PC/winreg.c
index aa2055c..5252f78 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -2079,15 +2079,9 @@ static struct PyMethodDef winreg_methods[] = {
} while (0)
static int
-inskey(PyObject *mod, char *name, HKEY key)
+inskey(PyObject *mod, const char *name, HKEY key)
{
- PyObject *v = PyLong_FromVoidPtr(key);
- if (v == NULL) {
- return -1;
- }
- int rc = PyModule_AddObjectRef(mod, name, v);
- Py_DECREF(v);
- return rc;
+ return PyModule_Add(mod, name, PyLong_FromVoidPtr(key));
}
#define ADD_KEY(VAL) do { \