New submission from ProgVal:

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

void
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:

PUSH(tb);
PUSH(val);
PUSH(exc);

----------
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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26845>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to