[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
INADA Naoki added the comment: Thanks, Serhiy. You're right. -- status: open -> closed ___ Python tracker ___

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think additional checks are not needed. PyObject_CallFunction() allows passing NULLs. -- ___ Python tracker ___

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor
STINNER Victor added the comment: "We use Flask. Flask is based on Werkzeug. Werkzeug imports inspect. inspect imports ast. ast imports _ast." Oh, this was unexpected to me :-) -- ___ Python tracker

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
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

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor
STINNER Victor added the comment: > The three identifiers are used in type. Dozen (100+) types using them. I tried once to put *all* (most common) _Py_IDENTIFIER() in a single file and share them, but I abandoned my attempt: http://bugs.python.org/issue19515#msg202385 Antoine Pitrou: "Well,

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor
STINNER Victor added the comment: +result = PyObject_CallFunction((PyObject*)_Type, "s(O){}", +type, base, +_PyUnicode_FromId(__fields), fnames, +_PyUnicode_FromId(___module__), +_PyUnicode_FromId(__ast));

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
Changes by INADA Naoki : -- resolution: -> fixed ___ Python tracker ___ ___

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset a507882736b2 by INADA Naoki in branch 'default': Issue #29369: Use Py_IDENTIFIER in Python-ast.c https://hg.python.org/cpython/rev/a507882736b2 -- nosy: +python-dev ___ Python tracker

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
INADA Naoki added the comment: > AST objects are supposed to be temporary. Interning strings used in the AST > processor would make these strings immortal and so increase the memory usage, > no? > What is the purpose of the patch? Speedup or reduce the memory usage? The three identifiers are

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. _Py_IDENTIFIER is private API, but is not new in Python-ast.c. I expect insignificant speedup and reduce the memory usage from the patch. -- nosy: +serhiy.storchaka ___ Python tracker

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor
STINNER Victor added the comment: > While I'm looking Python's memory usage, I found some dicts which key is not > interned "_fields", "_ast" and "__modules__". AST objects are supposed to be temporary. Interning strings used in the AST processor would make these strings immortal and so

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
Changes by INADA Naoki : Removed file: http://bugs.python.org/file46414/ast-identifier2.patch ___ Python tracker ___

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
Changes by INADA Naoki : Added file: http://bugs.python.org/file46415/ast-identifier3.patch ___ Python tracker ___

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
Changes by INADA Naoki : Added file: http://bugs.python.org/file46414/ast-identifier2.patch ___ Python tracker ___

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor
STINNER Victor added the comment: Python/Python-ast.c started with: /* File automatically generated by Parser/asdl_c.py. */ Please fix the generator, not the generated file ;-) -- nosy: +haypo ___ Python tracker

[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki
New submission from INADA Naoki: While I'm looking Python's memory usage, I found some dicts which key is not interned "_fields", "_ast" and "__modules__". -- components: Interpreter Core files: ast-identifier.patch keywords: patch messages: 286244 nosy: inada.naoki priority: normal