STINNER Victor <vstin...@python.org> added the comment:

This reference leak is not new :-) It exists since at least Python 2.7. Extract 
of Python 2.7, Python/pythonrun.c:

    sysmod = _PySys_Init();
    if (sysmod == NULL)
        Py_FatalError("Py_Initialize: can't initialize sys");
    interp->sysdict = PyModule_GetDict(sysmod);

There is a missing Py_DECREF(sysmod). It was the same bug here, except that the 
code was deeply refactored in the meanwhile. I fixed the reference leak in 
commit 080ee5a88406fb68aaab741145cd5d2a7c5f2ad6.

Next question: why did the buildbot turn red? Well, at Python exit, there are 
like 18k references which are never decremented at Python exit:

$ ./python -X showrefcount -c pass
[18562 refs, 6494 blocks]

Previously, the subinterpreter sys module somehow shared references with the 
main interpreter. With my latest changes, the subinterpreter better isolates 
its own sys module from the main interpreter, and so the very old bug suddenyl 
is "releaved".

Getting subinterpreter "right" requires to fix all these very old bugs, one by 
one...

----------

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

Reply via email to