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