[Python-checkins] bpo-40989: Fix compiler warning in winreg.c (GH-21722)

Victor Stinner webhook-mailer at python.org
Wed Aug 5 10:23:18 EDT 2020

commit: 15edaecd97a3f8e82895046462342d8ddd8b9f1b
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-08-05T16:23:10+02:00

bpo-40989: Fix compiler warning in winreg.c (GH-21722)

Explicitly cast PyHKEYObject* to PyObject* to call _PyObject_Init().

M PC/winreg.c

diff --git a/PC/winreg.c b/PC/winreg.c
index a24d784c773c0..78c08693a8ace 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -463,7 +463,7 @@ PyHKEY_FromHKEY(HKEY h)
     if (op == NULL) {
         return PyErr_NoMemory();
-    _PyObject_Init(op, &PyHKEY_Type);
+    _PyObject_Init((PyObject*)op, &PyHKEY_Type);
     op->hkey = h;
     return (PyObject *)op;

More information about the Python-checkins mailing list