Mangle __parameters in __annotations__ dict properly. Issue #20625.

This commit is contained in:
Yury Selivanov 2014-02-18 12:49:41 -05:00
parent b59e4425d5
commit 34ce99f66d
5 changed files with 37 additions and 1 deletions

View file

@ -1533,8 +1533,14 @@ compiler_visit_argannotation(struct compiler *c, identifier id,
{
if (annotation) {
VISIT(c, expr, annotation);
if (PyList_Append(names, id))
PyObject *mangled = _Py_Mangle(c->u->u_private, id);
if (!mangled)
return -1;
if (PyList_Append(names, mangled) < 0) {
Py_DECREF(mangled);
return -1;
}
Py_DECREF(mangled);
}
return 0;
}