[issue41796] _ast module state should be made per interpreter

STINNER Victor report at bugs.python.org
Tue Nov 3 07:33:55 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

There is a leak (I just marked bpo-42250 as duplicate of this issue):

https://buildbot.python.org/all/#/builders/205/builds/83

OK
......
test_ast leaked [23640, 23636, 23640] references, sum=70916
test_ast leaked [7932, 7930, 7932] memory blocks, sum=23794
1 test failed again:
    test_ast

test_subinterpreter() test leaks.

There are two problems:

* _PyAST_Fini() is only called in the main interpreter, I forgot to remove the "if _Py_IsMainInterpreter()"
* _PyAST_Fini() is called after the last GC collection, whereas AST_type contains a reference to itself (as any Python type) in its tp_mro member. A GC collection is required to destroy the type. _PyAST_Fini() must be called before the last GC collection.

----------
resolution: fixed -> 
status: closed -> open

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41796>
_______________________________________


More information about the Python-bugs-list mailing list