New submission from STINNER Victor: The namereplace error handler introduced in Python 3.5 doesn't handle correctly PyCapsule_Import() failure. If the function raises an exception, the PyCodec_NameReplaceErrors() function must return NULL.
I see that the code correctly handle the case where PyCodec_NameReplaceErrors() failed, but it doesn't clear the exception. Attached patch changes PyCodec_NameReplaceErrors() to return immediatly NULL if PyCodec_NameReplaceErrors() failed. Or should we log the exception (PyErr_WriteUnraisable) and then clear it? PyErr_WriteUnraisable is usually used in corner case when it's impossible to report bugs to the function caller. ---------- files: namereplace_errors.patch keywords: patch messages: 249628 nosy: haypo, serhiy.storchaka priority: normal severity: normal status: open title: The C function PyCodec_NameReplaceErrors doesn't handle PyCapsule_Import() failure versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file40336/namereplace_errors.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24993> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com