[New-bugs-announce] [issue26845] Misleading variable name in exception handling

ProgVal report at bugs.python.org
Mon Apr 25 15:56:07 EDT 2016

New submission from ProgVal:

In Python/errors.c, PyErr_Restore is defined this way:

PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback)

In Python/ceval.c, in the END_FINALLY case, it is called like this:

PyErr_Restore(status, exc, tb);

I believe “exc” should be renamed to “val”.

Indeed, END_FINALLY pops values from the stack like this:

PyObject *status = POP();
// ...
else if (PyExceptionClass_Check(status)) {
     PyObject *exc = POP();
     PyObject *tb = POP();
     PyErr_Restore(status, exc, tb);

And, they are pushed like this, in fast_block_end:


components: Interpreter Core
messages: 264198
nosy: Valentin.Lorentz
priority: normal
severity: normal
status: open
title: Misleading variable name in exception handling
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list