[issue32030] PEP 432: Rewrite Py_Main()

STINNER Victor report at bugs.python.org
Wed Nov 15 12:27:04 EST 2017


STINNER Victor <victor.stinner at gmail.com> added the comment:

I wrote a new "_PyInitError" type to report more information when something goes wrong:

* indicate if it's an user error: don't abort() in that case
* function name where the error was raised
* error message

Example:
---
$ PYTHONHASHSEED=x ./python
Fatal Python error: _Py_HashRandomization_Init: PYTHONHASHSEED must be "random" or an integer in range [0; 4294967295]
---

=> Python doesn't fail with abort() anymore
=> notice the new "_Py_HashRandomization_Init" function name which gives context to the error message


Previously, Python called abort() and so might dump a core file:
---
$ PYTHONHASHSEED=x python3
Fatal Python error: PYTHONHASHSEED must be "random" or an integer in range [0; 4294967295]

Aborted (core dumped)
---

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32030>
_______________________________________


More information about the Python-bugs-list mailing list