[issue29369] Use Py_IDENTIFIER in Python-ast.c

INADA Naoki report at bugs.python.org
Wed Jan 25 10:51:03 EST 2017


INADA Naoki added the comment:

> You should check if _PyUnicode_FromId() returns NULL if it was the first call and the UTF-8 decode failed to allocate memory.

thanks. new patch will fix it.

> You might initialize all these identifiers (and check for errors) in init_types() to avoid having to check for errors each time they are used.

Here is not so performance critical part.

> But the _ast module is not imported by default, only in programs importing "ast" explicitly.
> Well, I'm not opposed to the change, I'm just trying to understand how the code is used ;-)

We use Flask. Flask is based on Werkzeug. Werkzeug imports inspect.
inspect imports ast. ast imports _ast.

----------
Added file: http://bugs.python.org/file46416/ast-identifier4.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29369>
_______________________________________


More information about the Python-bugs-list mailing list