--- /dev/null
+Fix a crash in :func:`!_interpreters.capture_exception` when
+:exc:`MemoryError` happens. Patch by Amrutha Modela.
}
finally:
- _PyXI_FreeExcInfo(info);
+ if (info != NULL) {
+ _PyXI_FreeExcInfo(info);
+ }
if (exc != exc_arg) {
if (PyErr_Occurred()) {
PyErr_SetRaisedException(exc);
}
_PyXI_excinfo *info = PyMem_RawCalloc(1, sizeof(_PyXI_excinfo));
if (info == NULL) {
+ PyErr_NoMemory();
return NULL;
}
const char *failure;
void
_PyXI_FreeExcInfo(_PyXI_excinfo *info)
{
+ assert(info != NULL);
_PyXI_excinfo_clear(info);
PyMem_RawFree(info);
}