Xavier de Gaye added the comment: With pyerr_printex.patch we get the following correct results (rc=120 is set by Py_Main() after Py_FinalizeEx() returns with an error):
$ ./python memerr.py 5 12 set_nomemory(0, 5) result = _PythonRunResult(rc=1, out=b'', err=b'MemoryError\n\nDuring handling of the above exception, another exception occurred:\n\nMemoryError') ============================= set_nomemory(0, 6) result = _PythonRunResult(rc=1, out=b'', err=b'sys.excepthook is missing\nMemoryError\n\nDuring handling of the above exception, another exception occurred:\n\nMemoryError') ============================= set_nomemory(0, 7) result = _PythonRunResult(rc=1, out=b'', err=b'sys.excepthook is missing\nMemoryError\n\nDuring handling of the above exception, another exception occurred:\n\nMemoryError') ============================= set_nomemory(0, 8) result = _PythonRunResult(rc=1, out=b'', err=b'sys.excepthook is missing\nobject : MemoryError()\ntype : MemoryError\nrefcount: 1\naddress : 0x7f7ae1be3eb0\nlost sys.stderr') ============================= set_nomemory(0, 9) result = _PythonRunResult(rc=1, out=b'', err=b'sys.excepthook is missing\nobject : \ntype : MemoryError\nrefcount: 1\naddress : 0x7f8aead15eb0\nlost sys.stderr') ============================= set_nomemory(0, 10) result = _PythonRunResult(rc=1, out=b'', err=b'sys.excepthook is missing\nobject : \ntype : MemoryError\nrefcount: 1\naddress : 0x7f7b489d1eb0\nlost sys.stderr') ============================= set_nomemory(0, 11) result = _PythonRunResult(rc=1, out=b'', err=b'sys.excepthook is missing\nobject : \ntype : MemoryError\nrefcount: 1\naddress : 0x7ff97365eeb0\nlost sys.stderr') ============================= set_nomemory(0, 12) result = _PythonRunResult(rc=120, out=b'', err=b"sys.excepthook is missing\nobject : \ntype : MemoryError\nrefcount: 1\naddress : 0x7f559c9e0eb0\nlost sys.stderr\nException ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>\nMemoryError") ============================= ---------- keywords: +patch Added file: http://bugs.python.org/file46983/pyerr_printex.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30817> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com