Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doh
Browse files Browse the repository at this point in the history
erlend-aasland committed Apr 8, 2023

Verified

This commit was signed with the committer’s verified signature.
erlend-aasland Erlend E. Aasland
1 parent 25a07f8 commit 2c298f2
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions PC/winreg.c
Original file line number Diff line number Diff line change
@@ -2059,16 +2059,11 @@ static struct PyMethodDef winreg_methods[] = {
NULL,
};

static void
insint(PyObject * d, char * name, long value)
{
PyObject *v = PyLong_FromLong(value);
if (!v || PyDict_SetItemString(d, name, v))
PyErr_Clear();
Py_XDECREF(v);
}

#define ADD_INT(val) insint(d, #val, val)
#define ADD_INT(VAL) do { \
if (PyModule_AddIntConstant(m, #VAL, VAL) < 0) { \
goto error; \
} \
} while (0)

static int
inskey(PyObject *mod, char *name, HKEY key)
@@ -2077,7 +2072,7 @@ inskey(PyObject *mod, char *name, HKEY key)
if (v == NULL) {
return -1;
}
int rc = PyModule_AddObjectRef(name, v);
int rc = PyModule_AddObjectRef(mod, name, v);
Py_DECREF(v);
return rc;
}
@@ -2177,6 +2172,9 @@ PyMODINIT_FUNC PyInit_winreg(void)
ADD_INT(REG_RESOURCE_LIST);
ADD_INT(REG_FULL_RESOURCE_DESCRIPTOR);
ADD_INT(REG_RESOURCE_REQUIREMENTS_LIST);

#undef ADD_INT

return m;

error:

0 comments on commit 2c298f2

Please sign in to comment.