Fix a crash, when there's no memory left on a device,
-which happened in code compilation.
-Now it raises a proper :exc:`MemoryError`.
+which happened in:
+
+- code compilation
+- :func:`!_winapi.CreateProcess`
+
+Now these places raise proper :exc:`MemoryError` errors.
}
ret = PyMem_Malloc(*size);
- if (ret == NULL)
+ if (ret == NULL) {
+ PyErr_NoMemory();
goto cleanup;
+ }
for (i = 0; i < PySequence_Fast_GET_SIZE(value_fast); i++) {
ret[i] = PYNUM_TO_HANDLE(PySequence_Fast_GET_ITEM(value_fast, i));
attribute_list->attribute_list = PyMem_Malloc(attribute_list_size);
if (attribute_list->attribute_list == NULL) {
ret = -1;
+ PyErr_NoMemory();
goto cleanup;
}