]> granicus.if.org Git - python/commitdiff
bpo-30567: Fix refleak in sys.getwindowsversion (#1940)
authorSegev Finer <segev208@gmail.com>
Sun, 4 Jun 2017 17:52:27 +0000 (20:52 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 4 Jun 2017 17:52:27 +0000 (20:52 +0300)
Python/sysmodule.c

index a7b7508f4a1bc0674c3ab8d5fc5ab7dd90dc78ca..741060189c83170e0441da572cdb48c5f073a3bb 100644 (file)
@@ -973,10 +973,10 @@ sys_getwindowsversion(PyObject *self)
         }
         PyMem_RawFree(verblock);
     }
-    PyStructSequence_SET_ITEM(version, pos++, PyTuple_Pack(3,
-        PyLong_FromLong(realMajor),
-        PyLong_FromLong(realMinor),
-        PyLong_FromLong(realBuild)
+    PyStructSequence_SET_ITEM(version, pos++, Py_BuildValue("(kkk)",
+        realMajor,
+        realMinor,
+        realBuild
     ));
 
     if (PyErr_Occurred()) {