[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread hai shi
hai shi added the comment: Thanks for your patience, Serhiy. IMHO, i called the moving operation `clean code`: Consistent understanding, Consistent code. And the `clean code` should be a part of `enhancement`. -- ___ Python tracker

[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is no bug. We can add Py_INCREF/Py_DECREF in ast.c. We can remove Py_INCREF/Py_DECREF from compile.c. But all this would just add code churn. -- resolution: -> rejected stage: -> resolved status: open -> closed _

[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread hai shi
hai shi added the comment: > I don't understand the purpose of this issue. The bug tracker is not the > right place to ask question. If you think that it's a bug, please explain how > to trigger the bug. Hi, victor. What i want to express is that the refcount operation of filename should be

[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Because there is no need to use refcount. And there is no need to use refcount in compile.c too. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread STINNER Victor
STINNER Victor added the comment: > Due to victor add the desc(`/* borrowed reference */`) I added the comment, but the code was always like that. In short, borrowed references are used to simply the implementation (avoid the need to DECREF on error) and/or for efficiency. I don't understan

[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread hai shi
hai shi added the comment: Due to victor add the desc(`/* borrowed reference */`) so noisy+ victor ;) -- nosy: +vstinner ___ Python tracker ___ ___

[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread hai shi
New submission from hai shi : I don't know why don't use refcount ` /* borrowed reference */ c.c_filename = filename; ` in https://github.com/python/cpython/blob/master/Python/ast.c#L786-L787 like ` Py_INCREF(filename); c.c_filename = filename; ` in https://github.com/python/cpython/blob/master