[New-bugs-announce] [issue24993] The C function PyCodec_NameReplaceErrors doesn't handle PyCapsule_Import() failure

STINNER Victor report at bugs.python.org
Thu Sep 3 12:49:48 CEST 2015


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 <report at bugs.python.org>
<http://bugs.python.org/issue24993>
_______________________________________


More information about the New-bugs-announce mailing list