On 4/12/19, Giampaolo Rodola' <g.rod...@gmail.com> wrote: > > As such I was thinking that perhaps it would be nice to provide 2 new > cPython APIs: > > PyErr_SetFromErrnoWithMsg(PyObject *type, const char *msg) > PyErr_SetFromWindowsErrWithMsg(int ierr, const char *msg) > PyErr_SetExcFromWindowsErrWithMsg(PyObject *type, int ierr, const char > *msg) > > With this in place also OSError and WindowsError would probably have > to host a new "extramsg" attribute or something (but not necessarily).
Existing error handling would benefit from this proposal. win32_error [1], win32_error_object_error, and PyErr_SetFromWindowsErrWithFunction [2] take a function name that's currently ignored. [1]: https://github.com/python/cpython/blob/v3.7.3/Modules/posixmodule.c#L1403 [2]: https://github.com/python/cpython/blob/v3.7.3/PC/winreg.c#L26 _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/