STINNER Victor <[email protected]> added the comment:
Last year, I reworked Python initialization to introduce a new _PyInitError
structure which allows to report a failure to the caller of a function instead
of calling directly Py_FatalError() which always call abort() immediately.
_PyInitError allows to distinguish "user error" and "internal error". User
error is caused by an user mistake, whereas internal errors are all other
errors. User errors don't call abort() to avoid dumping a core dump.
It's not always easy to decide if a bug is caused by the user or not.
For example, a memory allocation failure is now considered as an "user error":
#define _Py_INIT_NO_MEMORY() _Py_INIT_USER_ERR("memory allocation failed")
See Include/coreconfig.h for the definition of _PyInitError and related macros.
One enhancement of this new API is that it now reports the name of the C
function which causes the error. The initial bug report says "Fatal Python
error: init_sys_streams: can't initialize sys standard
streams": init_sys_streams() function raised the fatal error.
----------
nosy: +vstinner
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35969>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com