Issue #16404: Add checks for return value of PyLong_FromLong() in
sys.getwindowsversion() and ossaudiodev.setparameters().
Reported by Ned Batchelder.
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 880385c..222630c 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -747,6 +747,10 @@
PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wSuiteMask));
PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wProductType));
+ if (PyErr_Occurred()) {
+ Py_DECREF(version);
+ return NULL;
+ }
return version;
}