Tim Peters <t...@python.org> added the comment:

Thanks for the succinct example!  Although you don't need the print() ;-)

I can confirm this crashes the same way under a current master build (albeit on 
Windows 64-bit).

gc is calculating how many references in the current generation are accounted 
for by intra-generation references, and gc's visit_decref() is getting called 
back by odictobject.c's odict_traverse(), on line

    Py_VISIT(od->od_weakreflist);

gc has found a second pointer to od->od_weakreflist, which is more than its 
refcount (1) claims exist.

Python's weakref implementation gives me headaches, so I'm adding Raymond to 
the nosy list under the hope the problem will be obvious to him.

----------
components: +Extension Modules -C API
nosy: +rhettinger, tim.peters
stage:  -> needs patch
versions: +Python 3.7, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39778>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to