[issue30542] [EASY] test_files() of test_tools.test_unparse.DirectoryTestCase leaks references

STINNER Victor report at bugs.python.org
Wed Jun 7 12:51:07 EDT 2017


STINNER Victor added the comment:

I isolated the leak to attached bug.py script. Output:
---
haypo at selma$ ./python bug.py 
[ Top 10 differences ]
bug.py:40: size=6728 B (+6728 B), count=80 (+80), average=84 B
bug.py:46: size=2464 B (+2464 B), count=28 (+28), average=88 B
bug.py:43: size=2464 B (+2464 B), count=28 (+28), average=88 B
---

It seems like compiling a Python source to AST causes the leak. The Python source uses the following bytecodes:

 25         170 LOAD_DEREF               0 (trace)
            172 LOAD_METHOD              0 (append)
            174 LOAD_CONST               0 (None)
            176 CALL_METHOD              1
            178 POP_TOP

AST of the code:

Expr(value=Call(func=Attribute(value=Name(id='trace', ctx=Load()), attr='append', ctx=Load()), args=[NameConstant(value=None)], keywords=[]))

----------
Added file: http://bugs.python.org/file46929/bug.py

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


More information about the Python-bugs-list mailing list