New submission from STINNER Victor:

Recently, the Python initialization was reworked to start to implement the PEP 
432:

- bpo-22257: commits 1abcf6700b4da6207fe859de40c6c1bada6b4fec and 
6b4be195cd8868b76eb6fbe166acc39beee8ce36

Now, Py_NewInterpreter() leaks a reference on warnoptions in _PySys_EndInit(). 
We tried with Stéphane Wirtel and Louie Lu to add Py_DECREF(warnoptions), but 
test_capi does crash with this change.

The problem is that warnoptions is stored in a C global variable *and* in 
sys.warnoptions of each interpreter. The ownership of this variable is unclear.

I don't think that it's a good idea to share a list between two interpreters 
and so I created this issue to propose to redesign this variable.

The tricky part is that the C global variable is also accessed by 2 public C 
functions: PySys_ResetWarnOptions() and PySys_AddWarnOptionUnicode().

----------
messages: 295399
nosy: eric.snow, haypo, ncoghlan
priority: normal
severity: normal
status: open
title: Py_NewInterpreter() leaks a reference on warnoptions in _PySys_EndInit()
type: resource usage
versions: Python 3.7

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

Reply via email to