New submission from STINNER Victor: Attached patch adds assertions to PyObject_GetItem() to ensure that an exception is raised if the function failed. _Py_CheckFunctionResult() could be used to implement such check, but it might adds a little overhead, whereas I really don't think that such bug occurs in the wild. The assertion only helps when you develop a new custom type implementing the mapping API.
The patch also simplifies Python/ceval.c: it now considers that an exception is raised if PyObject_GetItem() returns NULL. Finally, the patch also fixes a bug in the LOAD_NAME bytecode, when globals are not a dict but a custom type and the name doesn't exist in globals: clear the exception before calling PyObject_GetItem() on builtins. ---------- components: Interpreter Core messages: 254094 nosy: haypo, serhiy.storchaka priority: normal severity: normal status: open title: Fixes for PyObject_GetItem() versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25556> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com