New submission from Kay Hayen <kay.ha...@gmail.com>:
I have a test in Nuitka, designed to detect reference counting problems with Python code. It basically takes a snapshot of the refcount, runs a function until it stabilizes, then says PASS, or else reports the last diff. Obviously for CPython it's supposed to pass. Testing with self compiled 3.7.0 and 3.7.0-1 as in Debian testing (buster) currently, this happens for me: This is a cutout, there are more than 100 functions, I am listing the ones that report: simpleFunction16: FAILED 118414 118412 leaked -2 simpleFunction17: FAILED 118395 118393 leaked -2 simpleFunction18: FAILED 118375 118373 leaked -2 ... simpleFunction21: FAILED 118337 118333 leaked -4 ... simpleFunction25: FAILED 118315 118313 leaked -2 simpleFunction26: FAILED 118295 118293 leaked -2 ... simpleFunction38: FAILED 118257 118253 leaked -4 simpleFunction39: FAILED 118235 118233 leaked -2 ... simpleFunction43: FAILED 118215 118213 leaked -2 simpleFunction48: FAILED 118195 118193 leaked -2 ... simpleFunction76: FAILED 118422 118418 leaked -4 ... simpleFunction88: FAILED 118400 118398 leaked -2 This is really bad, because normally values are positive, merely preventing a release. A negative value indicates that references have been lost. This will normally result in corruption of the memory allocator for Python, although I have not yet seen that. I have a few remaining cases, where compiled code causes negative leaks too, there is happens. But I didn't force the issue yet. Notice that this is of course with the debug Python version and let me express, pure CPython is used to run the test code. When compiling with Nuitka and 3.7, my private code gives the same ref counts for there, but it also pretty much does the same things, these are some of the functions: def simpleFunction16(): class EmptyClass: pass return EmptyClass def simpleFunction39(): class Parent(object): pass All the other cases also use locally defined classes and only test cases using local classes are failing for me here. To reproduce is easy: git clone --branch develop http://git.nuitka.net/Nuitka.git python3.7-dbg Nuitka/tests/basics/Referencing.py Thanks, Kay Hayen ---------- messages: 321037 nosy: kayhayen priority: normal severity: normal status: open title: Reference loss for local classes versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34042> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com