This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Py_Finalize() doesn't clear all Python objects at exit
Type: resource usage Stage: resolved
Components: Interpreter Core, Subinterpreters Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: CharlieZhao, Jim Fasarakis-Hilliard, TCsaba, amaury.forgeotdarc, christian.heimes, corona10, eric.snow, erlendaasland, h-vetinari, isoschiz, koubaa, kumaraditya, kylotan, lukasz.langa, miss-islington, orsenthil, pconnell, petr.viktorin, phsilva, python-dev, santoso.wijaya, serhiy.storchaka, shihai1991, tlesher, vstinner, ysj.ray
Priority: normal Keywords: patch

Created on 2007-01-15 10:26 by kylotan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17835 merged shihai1991, 2020-01-05 13:28
PR 17883 closed shihai1991, 2020-01-07 00:36
PR 18030 merged shihai1991, 2020-01-16 11:57
PR 18032 closed shihai1991, 2020-01-16 16:27
PR 18049 closed shihai1991, 2020-01-18 10:45
PR 18050 merged shihai1991, 2020-01-18 11:05
PR 18065 merged shihai1991, 2020-01-19 11:02
PR 18066 closed shihai1991, 2020-01-19 11:25
PR 18358 merged shihai1991, 2020-02-05 07:54
PR 18365 closed shihai1991, 2020-02-05 12:50
PR 18374 merged shihai1991, 2020-02-06 08:57
PR 18404 merged shihai1991, 2020-02-07 12:55
PR 18486 merged shihai1991, 2020-02-12 14:31
PR 18608 merged shihai1991, 2020-02-22 14:31
PR 18613 merged shihai1991, 2020-02-23 07:38
PR 19012 merged shihai1991, 2020-03-15 07:38
PR 19015 merged corona10, 2020-03-15 11:53
PR 19018 merged shihai1991, 2020-03-15 14:12
PR 19022 merged miss-islington, 2020-03-15 19:39
PR 19021 merged miss-islington, 2020-03-15 19:39
PR 19044 merged corona10, 2020-03-17 15:18
PR 19057 merged corona10, 2020-03-18 10:50
PR 19069 merged shihai1991, 2020-03-19 10:40
PR 19071 closed corona10, 2020-03-19 14:35
PR 19074 merged corona10, 2020-03-19 15:22
PR 19084 merged shihai1991, 2020-03-20 05:31
PR 19100 closed shihai1991, 2020-03-21 10:00
PR 19107 merged phsilva, 2020-03-22 04:03
PR 19122 closed phsilva, 2020-03-23 18:31
PR 19128 merged vstinner, 2020-03-23 22:45
PR 19135 merged vstinner, 2020-03-24 15:23
PR 19140 merged vstinner, 2020-03-24 17:05
PR 19150 merged phsilva, 2020-03-25 01:18
PR 19151 merged phsilva, 2020-03-25 01:28
PR 19242 merged corona10, 2020-03-31 12:14
PR 19243 merged corona10, 2020-03-31 13:20
PR 19252 merged shihai1991, 2020-03-31 16:17
PR 19307 merged shihai1991, 2020-04-02 15:30
PR 19382 merged corona10, 2020-04-05 03:34
PR 19459 merged corona10, 2020-04-10 15:09
PR 19798 merged corona10, 2020-04-29 16:45
PR 19822 merged vstinner, 2020-04-30 21:01
PR 19907 merged corona10, 2020-05-04 18:39
PR 19923 merged corona10, 2020-05-05 12:19
PR 20540 merged corona10, 2020-05-30 14:29
PR 20763 closed vstinner, 2020-06-09 16:08
PR 20808 closed corona10, 2020-06-11 14:27
PR 20848 merged corona10, 2020-06-13 01:47
PR 20920 merged corona10, 2020-06-16 15:57
PR 21087 closed shihai1991, 2020-06-23 15:51
PR 21168 closed corona10, 2020-06-26 13:29
PR 21189 merged python-dev, 2020-06-27 22:42
PR 21269 merged vstinner, 2020-07-01 22:17
PR 21270 merged vstinner, 2020-07-01 23:21
PR 21294 merged corona10, 2020-07-03 14:11
PR 21319 closed koubaa, 2020-07-04 21:41
PR 21371 merged koubaa, 2020-07-07 14:01
PR 21375 closed koubaa, 2020-07-07 18:00
PR 21378 merged koubaa, 2020-07-07 21:12
PR 21418 closed koubaa, 2020-07-09 15:53
PR 21605 merged shihai1991, 2020-07-24 13:13
PR 21818 merged koubaa, 2020-08-10 21:12
PR 21855 merged koubaa, 2020-08-13 12:23
PR 21856 merged koubaa, 2020-08-13 12:23
PR 21896 closed shihai1991, 2020-08-16 03:44
PR 21902 merged shihai1991, 2020-08-17 14:43
PR 21985 closed koubaa, 2020-08-28 00:41
PR 21986 merged koubaa, 2020-08-28 02:17
PR 21995 merged koubaa, 2020-08-29 01:54
PR 22003 closed koubaa, 2020-08-29 16:25
PR 22049 merged koubaa, 2020-09-01 22:10
PR 22050 merged koubaa, 2020-09-01 22:11
PR 22051 merged koubaa, 2020-09-01 22:23
PR 22131 closed koubaa, 2020-09-07 13:51
PR 22134 merged koubaa, 2020-09-07 14:46
PR 22139 merged koubaa, 2020-09-07 16:35
PR 22145 closed koubaa, 2020-09-08 01:43
PR 22148 merged vstinner, 2020-09-08 11:51
PR 22149 merged vstinner, 2020-09-08 11:56
PR 22164 merged koubaa, 2020-09-09 01:41
PR 22165 merged koubaa, 2020-09-09 02:59
PR 22220 merged koubaa, 2020-09-12 23:35
PR 22222 merged koubaa, 2020-09-13 00:22
PR 22240 merged koubaa, 2020-09-14 14:17
PR 22242 open koubaa, 2020-09-14 18:41
PR 22328 merged koubaa, 2020-09-20 02:20
PR 22415 merged corona10, 2020-09-26 05:44
PR 22478 erlendaasland, 2020-10-01 15:08
PR 22489 merged koubaa, 2020-10-02 02:48
PR 22490 closed koubaa, 2020-10-02 03:06
PR 22712 merged vstinner, 2020-10-15 13:57
PR 22713 merged vstinner, 2020-10-15 14:24
PR 22838 closed petr.viktorin, 2020-10-20 21:44
PR 22880 merged christian.heimes, 2020-10-22 08:09
PR 23091 open koubaa, 2020-11-02 02:50
PR 23122 merged vstinner, 2020-11-03 10:51
PR 23146 merged vstinner, 2020-11-04 14:07
PR 23147 merged vstinner, 2020-11-04 14:17
PR 23148 closed erlendaasland, 2020-11-04 14:43
PR 23151 merged vstinner, 2020-11-04 15:44
PR 23170 merged erlendaasland, 2020-11-05 18:51
PR 23139 merged koubaa, 2020-11-07 03:08
PR 23188 open koubaa, 2020-11-07 03:13
PR 23234 merged vstinner, 2020-11-11 00:32
PR 23236 merged vstinner, 2020-11-11 12:41
PR 23304 open koubaa, 2020-11-15 19:01
PR 23358 merged christian.heimes, 2020-11-18 07:49
PR 23359 merged christian.heimes, 2020-11-18 08:18
PR 23360 merged christian.heimes, 2020-11-18 08:48
PR 23361 merged christian.heimes, 2020-11-18 09:55
PR 23376 merged christian.heimes, 2020-11-18 19:12
PR 23377 merged christian.heimes, 2020-11-18 19:34
PR 23378 merged vstinner, 2020-11-18 21:10
PR 23379 merged vstinner, 2020-11-18 22:47
PR 23381 closed vstinner, 2020-11-18 23:12
PR 23390 merged christian.heimes, 2020-11-19 08:18
PR 23393 merged erlendaasland, 2020-11-19 09:03
PR 23398 merged christian.heimes, 2020-11-19 11:09
PR 23401 closed corona10, 2020-11-19 13:48
PR 23402 merged corona10, 2020-11-19 13:52
PR 23404 merged christian.heimes, 2020-11-19 14:35
PR 23406 merged christian.heimes, 2020-11-19 15:55
PR 23409 merged christian.heimes, 2020-11-19 17:16
PR 23462 merged christian.heimes, 2020-11-22 12:48
PR 23443 serhiy.storchaka, 2020-11-23 10:06
PR 23443 serhiy.storchaka, 2020-11-23 10:06
PR 23535 open koubaa, 2020-11-28 01:35
PR 23598 merged vstinner, 2020-12-01 15:10
PR 23793 merged vstinner, 2020-12-16 08:50
PR 23811 merged vstinner, 2020-12-16 23:25
PR 23972 merged erlendaasland, 2020-12-27 22:56
PR 24095 merged erlendaasland, 2021-01-04 14:29
PR 24175 closed erlendaasland, 2021-01-08 22:44
PR 24205 merged corona10, 2021-01-13 06:14
PR 30522 closed CharlieZhao, 2022-01-11 01:07
PR 30525 closed kumaraditya, 2022-01-11 03:54
PR 30744 vstinner, 2022-01-21 11:40
PR 31555 merged vstinner, 2022-02-24 17:02
PR 31560 merged vstinner, 2022-02-25 02:02
Messages (185)
msg61054 - (view) Author: B Sizer (kylotan) Date: 2007-01-15 10:26
This C code:

#include <Python.h>
int main(int argc, char *argv[])
{
    Py_Initialize(); Py_Finalize();
    Py_Initialize(); Py_Finalize();
    Py_Initialize(); Py_Finalize();
    Py_Initialize(); Py_Finalize();
    Py_Initialize(); Py_Finalize();
    Py_Initialize(); Py_Finalize();
    Py_Initialize(); Py_Finalize();
}

Produces this output:
[7438 refs]
[7499 refs]
[7550 refs]
[7601 refs]
[7652 refs]
[7703 refs]
[7754 refs]

A similar program configured to call the Py_Initialize()/Py_Finalize() 1000 times ends up with:
...
[58295 refs]
[58346 refs]
[58397 refs]

This is with a fresh debug build of Python 2.5.0 on Windows XP, using Visual C++ 2003.
msg110895 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-20 13:41
Does the title of this issue accurately reflect the current status of the Python interpreter?
msg111024 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-07-21 09:20
Yes, some objects are not cleaned in finalization.
This is not a problem in usual cases though, when the interpreter is
started only once.
msg130729 - (view) Author: ysj.ray (ysj.ray) Date: 2011-03-13 07:12
> Does the title of this issue accurately reflect the current status of the Python interpreter?

Yes, here is the running result on current 3.3 latest code:
[37182 refs]
[39415 refs]
[41607 refs]
[43799 refs]
[45991 refs]
[48183 refs]
[50375 refs]


This seems to be a known bug that Py_Finalize() doesn't free all objects according doc http://docs.python.org/dev/c-api/init.html?highlight=py_finalize#Py_Finalize
msg248761 - (view) Author: Alex Budovski (Alex Budovski) Date: 2015-08-18 06:20
Interestingly enough, some of the leaked memory came from the finalize routine itself! Here's one example:

0:004> !heap -p -a 0x000000DB144346F0
    address 000000db144346f0 found in
    _HEAP @ db0cae0000
              HEAP_ENTRY Size Prev Flags            UserPtr UserSize - state
        000000db14434690 030a 0000  [00]   000000db144346c0    03074 - (busy)
        7ffc55628b04 ntdll!RtlpCallInterceptRoutine+0x0000000000000040
        7ffc555f9f36 ntdll!RtlAllocateHeap+0x0000000000079836
        7ffc2a60c4da ucrtbased!calloc_base+0x000000000000123a
        7ffc2a60c27d ucrtbased!calloc_base+0x0000000000000fdd
        7ffc2a60f34f ucrtbased!malloc_dbg+0x000000000000002f
        7ffc2a60fdde ucrtbased!malloc+0x000000000000001e
        5a5e6ef9 python36_d!_PyMem_RawMalloc+0x0000000000000029
        5a5e78c7 python36_d!_PyMem_DebugAlloc+0x0000000000000087
        5a5e5e6f python36_d!_PyMem_DebugMalloc+0x000000000000001f
        5a5e7230 python36_d!PyMem_Malloc+0x0000000000000030
        5a582047 python36_d!new_keys_object+0x0000000000000077
        5a57f7c5 python36_d!dictresize+0x0000000000000085
        5a57a4b2 python36_d!PyDict_Merge+0x0000000000000112
        5a57bf33 python36_d!PyDict_Update+0x0000000000000023
        5a75fb1d python36_d!PyImport_Cleanup+0x000000000000045d
        5a778f9e python36_d!Py_Finalize+0x000000000000005e
msg355187 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-23 00:11
I tested on the master branch of Python:
---
#include <Python.h>

void func()
{
    Py_Initialize(); Py_Finalize();
    Py_ssize_t cnt = _Py_GetRefTotal();
    printf("sys.gettotalrefcount(): %zd\n", cnt);
}

int main(int argc, char *argv[])
{
    Py_SetProgramName(L"./_testembed");
    for (int i=0; i < 10; i++) {
        func();
    }
}
---

Each iteration leaks around 5,000 Python objects:
---
sys.gettotalrefcount(): 15113
sys.gettotalrefcount(): 19527
sys.gettotalrefcount(): 23941
sys.gettotalrefcount(): 28355
sys.gettotalrefcount(): 32769
sys.gettotalrefcount(): 37183
sys.gettotalrefcount(): 41597
sys.gettotalrefcount(): 46011
sys.gettotalrefcount(): 50425
sys.gettotalrefcount(): 54839
---
msg355189 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-23 00:12
I marked bpo-6741 as a duplicate of this issue.
msg355191 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-23 00:16
I marked bpo-26888 as a duplicate of this issue.
msg355193 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-23 00:17
I marked bpo-21387 as a duplicate of this issue.
msg355194 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-23 00:19
One part of this issue is that all C extensions of the stdlib should be updated to implement the PEP 489 "Multi-phase extension module initialization".
msg355201 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-23 00:32
I marked bpo-32026 as a duplicate of this issue.
msg359342 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-01-05 13:30
One part of this issue is that all C extensions of the stdlib should be updated to implement the PEP 489 "Multi-phase extension module initialization".
> I try to port _json extension module to multiphase initialization module, but the baseline(using victor's code) in my vm not changed~
msg359482 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-01-07 00:41
Compare to _Py_ForgetReference(), _Py_INC_REFTOTAL in _Py_NewReference() looks redundant.

REF: https://github.com/python/cpython/blob/master/Include/object.h#L442

master brach baseline in my vm:
```
sys.gettotalrefcount(): 18049
sys.gettotalrefcount(): 22463
```

after PR17883
```
sys.gettotalrefcount(): 17589
sys.gettotalrefcount(): 22000
```
msg359830 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-01-12 03:11
FWIW, i counted the difference of each file's refs after `Py_Finalize()`.

[('Objects/dictobject.c', 21434), ('Python/marshal.c', 8135), ('Objects/codeobject.c', 6245), ('Objects/listobject.c', 6037), ('Objects/tupleobject.c', 4169), ('Objects/boolobject.c', 2433), ('Objects/object.c', 2364), ('Objects/unicodeobject.c', 1541), ('Objects/longobject.c', 1387), ('Objects/funcobject.c', 528), ('Objects/classobject.c', 528), ('Objects/abstract.c', 463), ('Python/structmember.c', 369), ('./Include/objimpl.h', 277), ('Objects/stringlib/partition.h', 273), ('Python/import.c', 259), ('Python/codecs.c', 197), ('./Modules/signalmodule.c', 61), ('./Modules/_threadmodule.c', 59), ('Objects/exceptions.c', 15), ('Objects/bytesobject.c', 5), ('./Modules/_weakref.c', 4), ('Python/_warnings.c', 3), ('./Modules/timemodule.c', 1), ('./Modules/_codecsmodule.c', 1), ('Objects/bytearrayobject.c', 1), ('Python/compile.c', 1), ('Objects/sliceobject.c', 0), ('Objects/memoryobject.c', 0), ('Python/context.c', -1), ('Objects/clinic/longobject.c.h', -1), ('Objects/enumobject.c', -1), ('Modules/gcmodule.c', -1), ('Objects/namespaceobject.c', -1), ('Objects/stringlib/unicode_format.h', -2), ('Objects/rangeobject.c', -3), ('Python/pystate.c', -4), ('Objects/fileobject.c', -14), ('./Modules/_io/clinic/bufferedio.c.h', -17), ('./Modules/_io/iobase.c', -21), ('Python/modsupport.c', -28), ('./Modules/_io/fileio.c', -28), ('Python/pylifecycle.c', -37), ('./Modules/_io/textio.c', -39), ('Objects/genobject.c', -53), ('Objects/weakrefobject.c', -54), ('./Modules/_io/bufferedio.c', -56), ('./Python/sysmodule.c', -68), ('./Modules/_io/_iomodule.c', -82), ('Python/errors.c', -90), ('Objects/descrobject.c', -110), ('Objects/structseq.c', -113), ('Python/bltinmodule.c', -118), ('Objects/setobject.c', -339), ('Objects/moduleobject.c', -454), ('./Modules/posixmodule.c', -614), ('./Modules/_abc.c', -664), ('Objects/call.c', -755), ('Objects/typeobject.c', -2035), ('Objects/frameobject.c', -6538), ('Python/ceval.c', -7857), ('./Include/object.h', -48292)]
msg360063 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-15 16:32
New changeset ed154c387efc5f978ec97900ec9e0ec6631d5498 by Victor Stinner (Hai Shi) in branch 'master':
bpo-1635741: Port _json extension module to multiphase initialization (PEP 489) (GH-17835)
https://github.com/python/cpython/commit/ed154c387efc5f978ec97900ec9e0ec6631d5498
msg361427 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-02-05 13:15
i thinkt that not checking `PyModule_AddObject()`'s result may cause this probleam too.

1) python-ast.c have one question, i fix it in PR18358.
2) most of the questions in extension module, for example: https://github.com/python/cpython/blob/master/Modules/gcmodule.c#L2019-L2022
msg361428 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-02-05 13:17
update the above info:
1) python-ast.c have one question, i fix it in PR18365.
msg361466 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-02-06 01:21
> 1) python-ast.c have one question, i fix it in PR18365.
> 2) most of the questions in extension module, for example: https://github.com/python/cpython/blob/master/Modules/gcmodule.c#L2019-L2022

brandt does relevant work already in PR17276PR38823.
msg361798 - (view) Author: miss-islington (miss-islington) Date: 2020-02-11 11:16
New changeset 1ea45ae257971ee7b648e3b031603a31fc059f81 by Hai Shi in branch 'master':
bpo-1635741: Port _codecs extension module to multiphase initialization (PEP 489) (GH-18065)
https://github.com/python/cpython/commit/1ea45ae257971ee7b648e3b031603a31fc059f81
msg362068 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-02-16 12:56
Leave a note for myself:
I check the remaining object roughly(though dump_refs function), most of remaining object is 'str', such as:
'0x7f779cf88880 [13] str'->'0x7f779cf88880 [26] str'

So far, I don't know which file and fileno create those object. MAYBE I need find a hack way to sign this mallocing operation?(not sure)
msg362124 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-17 09:11
New changeset b2b6e27bcab44e914d0a0b170e915d6f1604a76d by Hai Shi in branch 'master':
bpo-1635741: Port _crypt extension module to multiphase initialization (PEP 489) (GH-18404)
https://github.com/python/cpython/commit/b2b6e27bcab44e914d0a0b170e915d6f1604a76d
msg362143 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-17 13:49
New changeset 7d7956833cc37a9d42807cbfeb7dcc041970f579 by Hai Shi in branch 'master':
bpo-1635741: Port _contextvars module to multiphase initialization (PEP 489) (GH-18374)
https://github.com/python/cpython/commit/7d7956833cc37a9d42807cbfeb7dcc041970f579
msg362144 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-17 13:50
New changeset 4c1b6a6f4fc46add0097efb3026cf3f0c89f88a2 by Hai Shi in branch 'master':
bpo-1635741: Port _abc extension to multiphase initialization (PEP 489) (GH-18030)
https://github.com/python/cpython/commit/4c1b6a6f4fc46add0097efb3026cf3f0c89f88a2
msg362195 - (view) Author: miss-islington (miss-islington) Date: 2020-02-18 11:17
New changeset 5d38517aa1836542a5417b724c093bcb245f0f47 by Hai Shi in branch 'master':
bpo-1635741: Port _bz2 extension module to multiphase initialization(PEP 489) (GH-18050)
https://github.com/python/cpython/commit/5d38517aa1836542a5417b724c093bcb245f0f47
msg363935 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-11 16:46
New changeset a158168a787e82c4b7b18f6833153188e93627a5 by Hai Shi in branch 'master':
bpo-1635741: Port _locale extension module to multiphase initialization (PEP 489) (GH-18358)
https://github.com/python/cpython/commit/a158168a787e82c4b7b18f6833153188e93627a5
msg363936 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-11 16:49
New changeset 41fbf865a35d4fb64f047f98dc24690cb0c170fd by Hai Shi in branch 'master':
bpo-1635741: Port audioop extension module to multiphase initialization (PEP 489) (GH-18608)
https://github.com/python/cpython/commit/41fbf865a35d4fb64f047f98dc24690cb0c170fd
msg363937 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-11 16:50
New changeset aa0c0808efbfdee813d2829e49030c667da44e72 by Hai Shi in branch 'master':
bpo-1635741: Fix potential refleaks in binascii module (GH-18613)
https://github.com/python/cpython/commit/aa0c0808efbfdee813d2829e49030c667da44e72
msg363940 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-11 16:53
Thanks Hai Shi for your 3 latest PRs, I merged them.
msg363941 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-11 16:56
New changeset 196f1eb6adcfc6a7239330ef508b8bf9dff9940f by Hai Shi in branch 'master':
bpo-1635741: Fix refleaks of time module error handling (GH-18486)
https://github.com/python/cpython/commit/196f1eb6adcfc6a7239330ef508b8bf9dff9940f
msg364234 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-03-15 14:02
hundreds of encoding names can not be released in Py_Finalize().
for example: 
```
0x7ff482f589e0 [1] 'iso_8859_1_1987'
0x7ff482f58970 [1] 'iso_8859_1'
```
-->
```
0x7ff482f589e0 [2] 'iso_8859_1_1987'
0x7ff482f58970 [2] 'iso_8859_1'
```
msg364330 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-16 15:10
New changeset 356c878fbf2a97aa3ab7951fd7456d219ff0b466 by Dong-hee Na in branch 'master':
bpo-1635741: Port _statistics module to multiphase initialization (GH-19015)
https://github.com/python/cpython/commit/356c878fbf2a97aa3ab7951fd7456d219ff0b466
msg364379 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-17 01:15
New changeset 2037502613471a0a0a0262085cc50adb378ebbad by Hai Shi in branch 'master':
bpo-1635741: Port  _ctypes_test extension to multiphase initialization (PEP 489) (GH-19012)
https://github.com/python/cpython/commit/2037502613471a0a0a0262085cc50adb378ebbad
msg364463 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-17 17:46
New changeset 514c469719f149e1722a91a9d0c63bf89dfefb2a by Dong-hee Na in branch 'master':
bpo-1635741: Port itertools module to multiphase initialization (GH-19044)
https://github.com/python/cpython/commit/514c469719f149e1722a91a9d0c63bf89dfefb2a
msg364521 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-18 14:29
New changeset 4657a8a0d006c76699ba3d1d4d21a04860bb2586 by Dong-hee Na in branch 'master':
bpo-1635741: Port _heapq module to multiphase initialization (GH19057)
https://github.com/python/cpython/commit/4657a8a0d006c76699ba3d1d4d21a04860bb2586
msg364609 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-19 16:16
New changeset 77248a28896d39cae0a7e084965b9ffc2624b7f4 by Dong-hee Na in branch 'master':
bpo-1635741: Port _collections module to multiphase initialization (GH-19074)
https://github.com/python/cpython/commit/77248a28896d39cae0a7e084965b9ffc2624b7f4
msg364656 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-20 08:16
New changeset 8334f30a74abcf7e469b901afc307887aa85a888 by Hai Shi in branch 'master':
bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489) (GH-19084)
https://github.com/python/cpython/commit/8334f30a74abcf7e469b901afc307887aa85a888
msg364833 - (view) Author: Paulo Henrique Silva (phsilva) * Date: 2020-03-23 01:44
About half of the remaining refs are related to encodings. I noticed that caches on Lib/encodings/__init__.py and codec_search_cach of PyInterpreterState are the places holding the refs. I removed those caches and number went do to:

Before: 4382 refs left
After : 2344 refs left (-46%)

The way to destroy codec_search_cache was recently changed on #36854 and $38962.

(Not proposing to merge this, but my changes are at https://github.com/python/cpython/compare/master...phsilva:remove-codec-caches).
msg364836 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-03-23 05:15
> I noticed that caches on Lib/encodings/__init__.py and codec_search_cach of PyInterpreterState are the places holding the refs. I removed those caches and number went do to.

Good Catch, Paulo.
IMHO, caches is useful in codecs(it's improve the search efficiency).

I have two humble idea:
1. Clean all item of codec_search_xxx in `Py_Finalize()`;
2. change the refcount mechanism(in this case, refcount+1 or refcount+2 make no differenct);
msg364845 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-03-23 11:45
The last merged pull request, GH-GH-19084, causes refleaks in importlib tests. Stable buildbots are failing, I can reproduce on macOS Catalina.

You can test yourself by running:
$ ./python.exe -E -Wd -m test -uall,-gui -l -L -R: test_importlib

Master at 2de7ac9798 does not fail while the next commit, 8334f30a74, introduces the failure.
msg364871 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-03-23 18:15
> The last merged pull request, GH-GH-19084, causes refleaks in importlib tests. Stable buildbots are failing, I can reproduce on macOS Catalina.

thanks, Łukasz.
I catched this problem in my vm of centos too. I don't the broken reason temporarily.
msg364883 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-23 18:58
New changeset bd409bb5b78e7ccac5fcda9ab4cec770552f3090 by Paulo Henrique Silva in branch 'master':
bpo-1635741: Port time module to multiphase initialization (PEP 489) (GH-19107)
https://github.com/python/cpython/commit/bd409bb5b78e7ccac5fcda9ab4cec770552f3090
msg364906 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-23 22:42
> The last merged pull request, GH-GH-19084, causes refleaks in importlib tests. Stable buildbots are failing, I can reproduce on macOS Catalina.

I expect that the bug is non-trivial, so I prefer to open a separated issue: bpo-40050 "test_importlib leaked [6303, 6299, 6303] references".
msg364909 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-23 23:48
New changeset 188078c39dec24aa5b3f2073bdc9a68ebaae42de by Victor Stinner in branch 'master':
Revert "bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489) (GH-19084)" (#19128)
https://github.com/python/cpython/commit/188078c39dec24aa5b3f2073bdc9a68ebaae42de
msg364951 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-24 17:31
New changeset 93460d097f50db0870161a63911d61ce3c5f4583 by Victor Stinner in branch 'master':
bpo-1635741: Port _weakref extension module to multiphase initialization (PEP 489) (GH-19140)
https://github.com/python/cpython/commit/93460d097f50db0870161a63911d61ce3c5f4583
msg364952 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-24 17:32
I managed to identify bpo-40050 (test_importlib reference leak) root issue and to fix it, so I reapplied Hai Shi's change for _weakref.
msg364968 - (view) Author: Paulo Henrique Silva (phsilva) * Date: 2020-03-25 01:46
Updating on my findings on msg364833.

It looks like encodings module is not being destoyed at all and keeping all the encoding refs alive. Looks like some cycle but I am not sure yet how to solve it.

To validate this, I:
 - removed codec_search_cach of PyInterpreterState.
 - Py_DECREFd(encodings) after loading it on codecs.c.

Before: 4376 refs left (37fcbb65d4)
After :  352 refs left (-92%)

I've updated the changes at https://github.com/python/cpython/compare/master...phsilva:remove-codec-caches (not a proposed patch, just to validate the idea)
msg364971 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-25 02:18
New changeset f3d5ac47720045a72f7ef5af13046d9531e6007b by Paulo Henrique Silva in branch 'master':
bpo-1635741: Port operator module to multiphase initialization (PEP 489) (GH-19150)
https://github.com/python/cpython/commit/f3d5ac47720045a72f7ef5af13046d9531e6007b
msg364972 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-25 02:20
New changeset 7dd549eb08939e1927fba818116f5202e76f8d73 by Paulo Henrique Silva in branch 'master':
bpo-1635741: Port _functools module to multiphase initialization (PEP 489) (GH-19151)
https://github.com/python/cpython/commit/7dd549eb08939e1927fba818116f5202e76f8d73
msg364973 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-25 02:41
Hum, some clarification is needed here.

"Port xxx extension module to multiphase initialization (PEP 489)" changes are helping to fix "Py_Finalize() doesn't clear all Python objects at exit", but alone they don't fix all issues.

--

For example, if a module still uses globals using "static ..." in C, these globals will not be cleared magically. Example with _datetimemodule.c:

static PyObject *us_per_hour = NULL;    /* 1e6 * 3600 as Python int */
static PyObject *us_per_day = NULL;     /* 1e6 * 3600 * 24 as Python int */
static PyObject *us_per_week = NULL;    /* 1e6*3600*24*7 as Python int */

These variables initialized once in PyInit__datetime():

    us_per_hour = PyLong_FromDouble(3600000000.0);
    us_per_day = PyLong_FromDouble(86400000000.0);
    us_per_week = PyLong_FromDouble(604800000000.0);

Converting the module to multiphase initialization will not magically clear these variables at exit. The _datetime module should be modified to store these variables in a module state: this module could be cleared at exit.

The binascii is a good example: it has a module state, traverse, clear and free methods, and it uses the multiphase initialization. This module can be fully unloaded at exit.

It's a "simple" module: it doesn't define types for example.

--

Another issue is that converting a module to the multiphase initialization doesn't magically fully isolate two instances of the module. For exmaple, the _abc module still uses a type defined statically:

static PyTypeObject _abc_data_type = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "_abc_data",                        /*tp_name*/
    sizeof(_abc_data),                  /*tp_basicsize*/
    .tp_dealloc = (destructor)abc_data_dealloc,
    .tp_flags = Py_TPFLAGS_DEFAULT,
    .tp_alloc = PyType_GenericAlloc,
    .tp_new = abc_data_new,
};

Example:

vstinner@apu$ ./python
Python 3.9.0a5+ (heads/pr/19122:0ac3031a80, Mar 25 2020, 02:25:19) 
>>> import _abc
>>> class Bla: pass
... 
>>> _abc._abc_init(Bla)
>>> type(Bla._abc_impl)
<class '_abc_data'>

# load a second instance of the module
>>> import sys; del sys.modules['_abc']
>>> import _abc as _abc2
>>> class Bla2: pass
... 
>>> _abc._abc_init(Bla2)

>>> type(Bla2._abc_impl)
<class '_abc_data'>

# _abc and _abc2 have exactly the same type,
# they are not fully isolated
>>> type(Bla2._abc_impl) is type(Bla._abc_impl)
True


That's more an issue for subinterpreters: each interpreter should have its own fully isolated instance of an C extension module.
msg364975 - (view) Author: Paulo Henrique Silva (phsilva) * Date: 2020-03-25 03:23
Thanks for the clarifications. I will keep looking for simple modules, no state and easy to migrate but also dedicate more time to work on the more complex like datetime. I'm working on PR19122 corrections.
msg364987 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-25 12:54
> Thanks for the clarifications. I will keep looking for simple modules, no state and easy to migrate but also dedicate more time to work on the more complex like datetime. I'm working on PR19122 corrections.

I like changes which convert C extension modules to multiphase initialization API since they fix the error path: they implicitly ensures that the module is properly destroyed if something goes wrong.

Moreover, it will ease the work to fix the other issues that I listed.
msg365008 - (view) Author: B Sizer (kylotan) Date: 2020-03-25 18:17
Sorry for the noise, but I just wanted to say thanks to the people working on this issue 13 years after I reported it. :)  Far too many open-source projects arbitrarily close bugs just because they don't have time to fix them and they never get fixed, so I'm glad this wasn't the case here.
msg365017 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-03-25 19:22
>Sorry for the noise, but I just wanted to say thanks to the people working on this issue 13 years after I reported it. :)  Far too many open-source projects arbitrarily close bugs just because they don't have time to fix them and they never get fixed, so I'm glad this wasn't the case here.

cpython is a big family ;)
msg365043 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-26 01:26
> bpo-1635741: Port _functools module to multiphase initialization (PEP 489) (GH-19151)
> https://github.com/python/cpython/commit/7dd549eb08939e1927fba818116f5202e76f8d73

This change introduced a regression: bpo-40071 "test__xxsubinterpreters  leaked [1, 1, 1] references: test_ids_global()".
msg365386 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-31 12:43
New changeset 1cb763b8808745b9a368c1158fda19d329f63f6f by Dong-hee Na in branch 'master':
bpo-1635741: Port _uuid module to multiphase initialization (GH-19242)
https://github.com/python/cpython/commit/1cb763b8808745b9a368c1158fda19d329f63f6f
msg365388 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-31 14:33
New changeset 5be8241392453751beea21d2e32096c15a8d47db by Dong-hee Na in branch 'master':
bpo-1635741: Port math module to multiphase initialization (GH-19243)
https://github.com/python/cpython/commit/5be8241392453751beea21d2e32096c15a8d47db
msg365484 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-01 15:12
I created bpo-40137: TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented.

It tracks code that should be fixed once PEP 573 will be implemented, like _functools and _abc modules.
msg365584 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-02 12:35
New changeset 45f7008a66a30cdf749ec03e580bd2692be9a8df by Hai Shi in branch 'master':
bpo-1635741: Port resource extension module to multiphase initialization (PEP 489) (GH-19252)
https://github.com/python/cpython/commit/45f7008a66a30cdf749ec03e580bd2692be9a8df
msg365611 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-02 18:00
New changeset 7a6f3bcc43ed729f8038524528c0b326b5610506 by Hai Shi in branch 'master':
bpo-1635741: Fix refleak in _locale init error handling (GH-19307)
https://github.com/python/cpython/commit/7a6f3bcc43ed729f8038524528c0b326b5610506
msg367686 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-04-29 18:20
New changeset 84724dd239c30043616487812f6a710b1d70cd4b by Dong-hee Na in branch 'master':
bpo-1635741: Port _stat module to multiphase initialization (GH-19798)
https://github.com/python/cpython/commit/84724dd239c30043616487812f6a710b1d70cd4b
msg367796 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-30 22:44
New changeset b66c0ff8af0c1a4adc6908897b2d05afc78cc27e by Victor Stinner in branch 'master':
bpo-1635741: Fix compiler warning in _stat.c (GH-19822)
https://github.com/python/cpython/commit/b66c0ff8af0c1a4adc6908897b2d05afc78cc27e
msg368096 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-05-05 01:49
New changeset 92a98ed97513c6e365ce8765550ea65d0ddc8cd7 by Dong-hee Na in branch 'master':
bpo-1635741: Port syslog module to multiphase initialization (GH-19907)
https://github.com/python/cpython/commit/92a98ed97513c6e365ce8765550ea65d0ddc8cd7
msg368318 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-05-07 01:17
New changeset 3466922320d54a922cfe6d6d44e89e1cea4023ef by Dong-hee Na in branch 'master':
bpo-1635741: Port errno module to multiphase initialization (GH-19923)
https://github.com/python/cpython/commit/3466922320d54a922cfe6d6d44e89e1cea4023ef
msg370561 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-06-01 16:12
New changeset e9684fac5a158be9806304a676e619857520a4dc by Dong-hee Na in branch 'master':
bpo-1635741: Port fcntl module to multiphase initialization (GH-20540)
https://github.com/python/cpython/commit/e9684fac5a158be9806304a676e619857520a4dc
msg370763 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-06-05 15:01
New changeset 3ad52e366fea37b02a3f619e6b7cffa7dfbdfa2e by Dong-hee Na in branch 'master':
bpo-1635741: Port mmap module to multiphase initialization (GH-19459)
https://github.com/python/cpython/commit/3ad52e366fea37b02a3f619e6b7cffa7dfbdfa2e
msg371119 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-09 16:10
I wrote PR 20763 to "finalize" static types in Py_Finalize(). It mostly works, but "./Programs/_testembed test_forced_io_encoding" crash. This program calls Py_Initialize() and Py_Finalize() multiple times in a loop.

It doesn't look to be safe to clear static types. Many functions rely on the fact that static types are "always there" and are never finalized. Also, only a few static types are cleared by my PR: many static types are left unchanged. For example, static types of the _io module.

It seems like a safer approach is to continue the work on bpo-40077: "Convert static types to PyType_FromSpec()".
msg371569 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-06-15 16:21
New changeset bf69a8f99f1b0e19a59509c6c4d7015a31d881a1 by Dong-hee Na in branch 'master':
bpo-1635741: Port _dbm module to multiphase initialization (GH-20848)
https://github.com/python/cpython/commit/bf69a8f99f1b0e19a59509c6c4d7015a31d881a1
msg371683 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-06-16 16:41
New changeset c4862e333ab405dd5789b4061222db1982147de4 by Dong-hee Na in branch 'master':
bpo-1635741: Port _gdbm module to multiphase initialization (GH-20920)
https://github.com/python/cpython/commit/c4862e333ab405dd5789b4061222db1982147de4
msg372061 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-22 09:22
See also the 48 open issues with "pep3121" keyword:

https://bugs.python.org/issue?%40search_text=&ignore=file%3Acontent&title=&%40columns=title&id=&%40columns=id&stage=&creation=&creator=&activity=&%40columns=activity&%40sort=activity&actor=&nosy=&type=&components=&versions=&dependencies=&assignee=&keywords=13&priority=&status=1&%40columns=status&resolution=&nosy_count=&message_count=&%40group=&%40pagesize=50&%40startwith=0&%40sortdir=on&%40queryname=&%40old-queryname=&%40action=search

(yeah enjoy the ugly Roundup URL...)
msg372077 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-22 09:35
See meta bpo-15787 "PEP 3121, 384 Refactoring" which tracks all these issues as dependencies.
msg372096 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-06-22 15:53
New changeset 1937edd376274cb26090d71253191502a9de32d6 by Dong-hee Na in branch 'master':
bpo-1635741: Port _lzma module to multiphase initialization  (GH-19382)
https://github.com/python/cpython/commit/1937edd376274cb26090d71253191502a9de32d6
msg372102 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-22 16:57
Current status: 60 stdlib extensions (51%) are ported to PEP 489 multiphase initialization, 58 stdlib extensions (49%) are still using the legacy API:

$ grep -E '\<PyModule_Create\>' $(find Modules/ -name "*.c")|wc -l
60

$ grep -E '\<PyModuleDef_Init\>' $(find Modules/ -name "*.c")|wc -l
58
msg372103 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-22 16:58
List of the 58 C extensions using the legacy API:

_asynciomodule.c
_bisectmodule.c
_blake2/blake2module.c
cjkcodecs/multibytecodec.c
cmathmodule.c
_csv.c
_ctypes/_ctypes.c
_cursesmodule.c
_curses_panel.c
_datetimemodule.c
_decimal/_decimal.c
_elementtree.c
faulthandler.c
gcmodule.c
grpmodule.c
_hashopenssl.c
_io/_iomodule.c
_lsprof.c
md5module.c
_multiprocessing/multiprocessing.c
_multiprocessing/posixshmem.c
_opcode.c
ossaudiodev.c
overlapped.c
_pickle.c
_posixsubprocess.c
pwdmodule.c
pyexpat.c
_queuemodule.c
_randommodule.c
readline.c
_scproxy.c
selectmodule.c
sha1module.c
sha256module.c
_sha3/sha3module.c
sha512module.c
signalmodule.c
socketmodule.c
spwdmodule.c
_sqlite/module.c
_sre.c
_ssl.c
_struct.c
symtablemodule.c
termios.c
_testbuffer.c
_testcapimodule.c
_testimportmultiple.c
_testinternalcapi.c
_threadmodule.c
_tkinter.c
_tracemalloc.c
unicodedata.c
_winapi.c
_xxsubinterpretersmodule.c
_xxtestfuzz/_xxtestfuzz.c
zlibmodule.c
msg372797 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-07-01 23:20
New changeset 666ecfb0957a2fa0df5e2bd03804195de74bdfbf by Victor Stinner in branch 'master':
bpo-1635741: Release Unicode interned strings at exit (GH-21269)
https://github.com/python/cpython/commit/666ecfb0957a2fa0df5e2bd03804195de74bdfbf
msg372912 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-07-03 09:00
New changeset 9d006977d7ff5a45d6e7d696c1713fdf2dd308b7 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port sha256 module to multiphase init (PEP 489) (GH-21189)
https://github.com/python/cpython/commit/9d006977d7ff5a45d6e7d696c1713fdf2dd308b7
msg372938 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-07-03 14:59
New changeset 3549ca313a6103a3adb281ef3a849298b7d7f72c by Victor Stinner in branch 'master':
bpo-1635741: Fix unicode_dealloc() for mortal interned string (GH-21270)
https://github.com/python/cpython/commit/3549ca313a6103a3adb281ef3a849298b7d7f72c
msg372942 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-07-03 16:36
New changeset c0b214bc08f0da89e5b2e4b8cc9f07783833d6b8 by Dong-hee Na in branch 'master':
bpo-1635741: Port faulthandler module to multiphase initialization (GH-21294)
https://github.com/python/cpython/commit/c0b214bc08f0da89e5b2e4b8cc9f07783833d6b8
msg375169 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-11 10:32
New changeset 1d541c25c8019f7a0b80b3e1b437abe171e40b65 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port multiprocessing ext to multiphase init (GH-21378)
https://github.com/python/cpython/commit/1d541c25c8019f7a0b80b3e1b437abe171e40b65
msg375272 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-08-12 17:45
There will have many unicode strs releaks when we calling `Py_Initialize()` again after `Py_Finalize()`: interned will be cleared in `Py_Finalize()`, but those unicodes str will still alive all the time.

Q: How to solve the probleam?
A: MAYBE we need share the interned of unicodeobject.c all the time and don't care how many times we will calling `Py_Initialize(); Py_Finalize();`
msg375286 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-12 21:17
> There will have many unicode strs releaks when we calling `Py_Initialize()` again after `Py_Finalize()`: interned will be cleared in `Py_Finalize()`, but those unicodes str will still alive all the time.

Py_Finalize() calls _PyUnicode_ClearInterned() which clears interned strings. Which strings are still alive after Py_Finalize()?
msg375287 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-12 21:23
New changeset 8ecc0c4d390d03de5cd2344aa44b69ed02ffe470 by Hai Shi in branch 'master':
bpo-1635741: Clean sysdict and builtins of interpreter at exit (GH-21605)
https://github.com/python/cpython/commit/8ecc0c4d390d03de5cd2344aa44b69ed02ffe470
msg375288 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-12 21:56
> Q: How to solve the problem?

Making sure that the "total reference count" is zero after Py_Finalize() is a long term project which requires to solve many subproblems:

* Convert static types to heap types: bpo-40077
* Somehow related, convert extension modules to multiphase initialization (PEP 489): this issue
* Identify remaining global variables and either clear them explicitly, or move them to a structure which is cleared at exit

To convert extension modules to multiphase init, one practical problem is that the PEP 573 doesn't cover slots and a few other corner cases. The PEP 573 should be extended:
https://mail.python.org/archives/list/capi-sig@python.org/thread/6CGIIZVMJRYHWZDJLNWCLPSYYAVRRVCC/

There are likely a bunch of other misc corner cases which should be fixed as well.
msg375290 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2020-08-13 04:46
> Py_Finalize() calls _PyUnicode_ClearInterned() which clears interned strings. Which strings are still alive after Py_Finalize()?

Yes.especially those encodings, interpreter leaks much encodings refcount after Py_Finalize(). I am not sure they are corner cases or not.
Maybe we could check it again afer we have done all convert works.

No matter how many times `Py_Initialize(); Py_Finalize();` have called, Holding a same interned of unicodeobject.c all the time sound like a stupied idea.
msg375311 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-13 14:23
New changeset e087f7cd43dfa4223c55a8ecd71f4a7d685178e4 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _winapi ext to multi-stage init (GH-21371)
https://github.com/python/cpython/commit/e087f7cd43dfa4223c55a8ecd71f4a7d685178e4
msg375567 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-17 20:36
New changeset 8aa163eea6b0fb4693f6c0a314d4f2ccada51d70 by Hai Shi in branch 'master':
bpo-1635741: Explict GC collect after PyInterpreterState_Clear() (GH-21902)
https://github.com/python/cpython/commit/8aa163eea6b0fb4693f6c0a314d4f2ccada51d70
msg376218 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-02 09:45
New changeset a7f026870d2dab7015a94e287bec6dd46cdbf604 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _blake2 module to multi-phase init (GH-21856)
https://github.com/python/cpython/commit/a7f026870d2dab7015a94e287bec6dd46cdbf604
msg376221 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-02 09:55
New changeset 93d50a6a8d0c5d332c11aef267e66573a09765ac by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _sha3 module to multi-phase init (GH-21855)
https://github.com/python/cpython/commit/93d50a6a8d0c5d332c11aef267e66573a09765ac
msg376240 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-02 14:28
I created bpo-41692: "Deprecate immortal interned strings: PyUnicode_InternImmortal()".
msg376288 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-03 08:21
New changeset 71d1bd9569c8a497e279f2fea6fe47cd70a87ea3 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _signal module to multi-phase init (PEP 489) (GH-22049)
https://github.com/python/cpython/commit/71d1bd9569c8a497e279f2fea6fe47cd70a87ea3
msg376360 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-04 11:52
> bpo-1635741: Port _signal module to multi-phase init (PEP 489) (GH-22049)

This change is causing new issues: bpo-41713 "_signal module leak: test_interpreters leaked [1424, 1422, 1424] references". So I partially reverted it: PR 22087.
msg376461 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-06 10:10
New changeset 63f102fe079ecb5cb7b921a1cf8bce4077a9d7e2 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _sha1, _sha512, _md5 to multiphase init (GH-21818)
https://github.com/python/cpython/commit/63f102fe079ecb5cb7b921a1cf8bce4077a9d7e2
msg376474 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-07 08:28
New changeset 1aaa21ff818b08af2a68862b552b7ba0857492eb by Mohamed Koubaa in branch 'master':
bpo-1635741 port zlib module to multi-phase init (GH-21995)
https://github.com/python/cpython/commit/1aaa21ff818b08af2a68862b552b7ba0857492eb
msg376477 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-07 08:49
New changeset 426f2b4f13f392875e7861dbd7f34735731eff17 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _opcode module to multi-phase init (PEP 489) (GH-22050)
https://github.com/python/cpython/commit/426f2b4f13f392875e7861dbd7f34735731eff17
msg376480 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-07 13:12
New changeset 2aabc3200bf03d2ec1aa987e1e20db704948111e by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _overlapped module to multi-phase init (GH-22051)
https://github.com/python/cpython/commit/2aabc3200bf03d2ec1aa987e1e20db704948111e
msg376493 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-07 14:02
I closed the following issues as duplicates of this issue:

* bpo-15686: "PEP 3121, 384 Refactoring applied to md5 module"
* bpo-15733: "PEP 3121, 384 Refactoring applied to winapi module"
* bpo-15680: "PEP 3121 refactoring applied to audioop module"
* bpo-15706: "PEP 3121, 384 Refactoring applied to sha512 module"
* bpo-15704: "PEP 3121, 384 Refactoring applied to sha1 module"
* bpo-15681: "PEP 3121 refactoring applied to binascii module"
* bpo-15662: "PEP 3121 refactoring applied to locale module"

and also: bpo-31862: "Port the standard library to PEP 489 multiphase initialization" (binascii).

I also marked bpo-15682 "PEP 3121 refactoring applied to fpectl module" and bpo-15684 "PEP 3121 refactoring applied to fpetest module" as duplicates of bpo-29137: the fpectl module was removed in Python 3.7.

Note: _sha256 module is not ported yet (bpo-15705).
msg376500 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-07 15:14
New changeset 1baf030a902392fe92d934ed0fb6a385cf7d8869 by Mohamed Koubaa in branch 'master':
bpo-1635741 port _curses_panel to multi-phase init (PEP 489) (GH-21986)
https://github.com/python/cpython/commit/1baf030a902392fe92d934ed0fb6a385cf7d8869
msg376552 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 08:59
New changeset 15dcdb211366e0788e831fc2a1f785e6a5ca2749 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port the termios to multi-phase init (PEP 489) (GH-22139)
https://github.com/python/cpython/commit/15dcdb211366e0788e831fc2a1f785e6a5ca2749
msg376554 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 09:00
I marked bpo-15709 "PEP 3121, 384 Refactoring applied to termios module" as a duplicate of this issue.
msg376555 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 09:07
I rejected the PR 19122 which tries to port the _datetime module to the multi-phase initialization API (PEP 489). We need first to enhance the PyCapsule C API to pass the module instance to C functions, somehow.

Extension modules calling PyCapsule_New() in their init function:

* _curses
* _datetime
* _decimal
* _socket
* pyexpat
* unicodedata
msg376556 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 09:16
New changeset 52a2df135c0470b1dbf889edc51b7c556ae4bc80 by Mohamed Koubaa in branch 'master':
bpo-1635741: Convert _sha256 types to heap types (GH-22134)
https://github.com/python/cpython/commit/52a2df135c0470b1dbf889edc51b7c556ae4bc80
msg376566 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 11:45
2020-06-22 16:58: "List of the 58 C extensions using the legacy API (...)"

UPDATE: 56% of Modules/*.c modules are converted (48 on 85).

Since June, 21 extension modules have been converted. There are now 37 remaining extensions which still use PyModule_Create():

$ grep -l  '\<PyModule_Create\> *(' Modules/*.c|wc -l
37

Modules/*.c:

* 48 files use PyModuleDef_Init()
* 37 files use PyModule_Create()
* 9 files are not modules:

Modules/config.c
Modules/getaddrinfo.c
Modules/getbuildinfo.c
Modules/getnameinfo.c
Modules/getpath.c
Modules/main.c
Modules/_math.c
Modules/rotatingtree.c
Modules/tkappinit.c

--

Outside the Modules/ directory, there are 6 modules using PyModule_Create:

$ grep -l  '\<PyModule_Create\> *(' */*.c|grep -v Modules

Objects/unicodeobject.c
PC/_msi.c
PC/msvcrtmodule.c
PC/winreg.c
PC/winsound.c
Python/import.c
Python/marshal.c
Python/_warnings.c
msg376567 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 12:03
> Python/_warnings.c

I'm not sure if it's a good idea to convert the _warnings module to multi-phase init, since it uses a state stored in the interpreter:

/* Given a module object, get its per-module state. */
static WarningsState *
warnings_get_state(void)
{
    PyInterpreterState *interp = _PyInterpreterState_GET();
    if (interp == NULL) {
        PyErr_SetString(PyExc_RuntimeError,
                        "warnings_get_state: could not identify "
                        "current interpreter");
        return NULL;
    }
    return &interp->warnings;
}

For example, two _warnings instance would share the _warnings.filters list. Maybe it's ok, I don't know.
msg376571 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 13:33
New changeset bb083d33f7ffe93cee9e1f63d1e526dc81a6e34f by Victor Stinner in branch 'master':
bpo-1635741: Port _string module to multi-phase init (GH-22148)
https://github.com/python/cpython/commit/bb083d33f7ffe93cee9e1f63d1e526dc81a6e34f
msg376572 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-08 13:33
New changeset f315142ddc61e54a59028db562aec5f62db783e1 by Victor Stinner in branch 'master':
bpo-1635741: Port mashal module to multi-phase init (#22149)
https://github.com/python/cpython/commit/f315142ddc61e54a59028db562aec5f62db783e1
msg376616 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-09 03:28
New changeset 3ff6975e2c0af0399467f234b2e307cc76efcfa9 by Mohamed Koubaa in branch 'master':
bpo-1635741: port scproxy to multi-phase init (GH-22164)
https://github.com/python/cpython/commit/3ff6975e2c0af0399467f234b2e307cc76efcfa9
msg376687 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-10 14:09
New changeset f76d894dc5d5facce1a6c1b71637f6a2b3f9fd2b by Mohamed Koubaa in branch 'master':
bpo-1635741: Port cmath to multi-phase init (PEP 489) (GH-22165)
https://github.com/python/cpython/commit/f76d894dc5d5facce1a6c1b71637f6a2b3f9fd2b
msg376993 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-16 14:08
> I rejected the PR 19122 which tries to port the _datetime module to the multi-phase initialization API (PEP 489). We need first to enhance the PyCapsule C API to pass the module instance to C functions, somehow.

I created bpo-41798: [C API] Revisit usage of the PyCapsule C API with multi-phase initialization API.
msg377253 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-21 12:40
New changeset 1b328ea9a7d15de4a8c9d0eb8aee94f6c75c1b46 by Mohamed Koubaa in branch 'master':
bpo-1635741: Convert an  _lsprof method to argument clinic (GH-22240)
https://github.com/python/cpython/commit/1b328ea9a7d15de4a8c9d0eb8aee94f6c75c1b46
msg377364 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-23 10:33
New changeset 83de110dce94a9196dccc01d526628615714e362 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port _lsprof extension to multi-phase init (PEP 489) (GH-22220)
https://github.com/python/cpython/commit/83de110dce94a9196dccc01d526628615714e362
msg377365 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-23 10:38
New changeset ddc0dd001a4224274ba6f83568b45a1dd88c6fc6 by Mohamed Koubaa in branch 'master':
bpo-1635741, unicodedata: add ucd_type parameter to UCD_Check() macro (GH-22328)
https://github.com/python/cpython/commit/ddc0dd001a4224274ba6f83568b45a1dd88c6fc6
msg377523 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-09-26 10:56
New changeset 2afd1751dd9a35d4ec03b708e3e5cddd72c43f7e by Dong-hee Na in branch 'master':
bpo-1635741: Port _bisect module to multi-phase init (GH-22415)
https://github.com/python/cpython/commit/2afd1751dd9a35d4ec03b708e3e5cddd72c43f7e
msg378115 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-06 11:28
Statistics on C extension modules using the old API (PyModule_Create) / new API (PyModuleDef_Init):

* 3.5: 84 / 24 (22%), total: 108
* 3.6: 87 / 25 (22%), total: 112 (+4)
* 3.7 : 89 / 26 (23%), total: 115 (+3)
* 3.8: 91 / 27 (23%), total: 118 (+3)
* 3.9: 68 / 52 (43%), total: 120 (+2)
* master: 42 / 76 (64%), total: 118 (-2)

Before Python 3.8, it doesn't evolve much. Between 3.8 and 3.9, 25 extensions have been ported to the new API. Between 3.9 and master, 24 more extensions have been ported. Nice work so far!

I didn't check if these extensions use a module state or if they still use some kind of global shared state such as static types. I just used a dummy grep:

grep -E '\<PyModule_Create\>' $(find Modules/ -name "*.c")|wc -l

grep -E '\<PyModuleDef_Init\>' $(find Modules/ -name "*.c")|wc -l

Anyway, it's going in the right direction!
msg378685 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-15 14:22
New changeset e6b8c5263a7fcf5b95d0fd4c900e5949eeb6630d by Victor Stinner in branch 'master':
bpo-1635741: Add a global module state to unicodedata (GH-22712)
https://github.com/python/cpython/commit/e6b8c5263a7fcf5b95d0fd4c900e5949eeb6630d
msg379280 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-10-22 08:06
The commit

    bpo-1635741: Port multiprocessing ext to multiphase init (GH-21378)
    https://github.com/python/cpython/commit/1d541c25c8019f7a0b80b3e1b437abe171e40b65


introduced a NULL pointer deref:

        if (py_sem_value_max == NULL) {
            Py_DECREF(py_sem_value_max);
            return -1;
        }
msg379287 - (view) Author: miss-islington (miss-islington) Date: 2020-10-22 10:20
New changeset dde91b1953c0f0d51c4dde056727ff84b7655190 by Christian Heimes in branch 'master':
bpo-1635741: Fix NULL ptr deref in multiprocessing (GH-22880)
https://github.com/python/cpython/commit/dde91b1953c0f0d51c4dde056727ff84b7655190
msg379667 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-26 15:43
New changeset 47e1afd2a1793b5818a16c41307a4ce976331649 by Victor Stinner in branch 'master':
bpo-1635741: _PyUnicode_Name_CAPI moves to internal C API (GH-22713)
https://github.com/python/cpython/commit/47e1afd2a1793b5818a16c41307a4ce976331649
msg380216 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-02 12:11
I converted the unicodedata extension to the multi-phase initialization API in bpo-42157 with Mohamed Koubaa.
msg380270 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2020-11-03 11:37
I've converted _sre to multi-phase init in this branch: https://github.com/erlend-aasland/cpython/tree/bpo-1635741/sre

I'm waiting for GH-23101 to be merged (or rejected) before I submit the PR. It's a fairly large PR (1 file changed, 259 insertions(+), 173 deletions(-), ex. clinic code). Let me know if you want me to split it up.

Here's an overview over the commits in the branch (clinic included):
97fc9aad3f (HEAD -> bpo-1635741/sre, origin/bpo-1635741/sre) Convert _sre to multi-phase initialisation
 1 file changed, 55 insertions(+), 15 deletions(-)
f2cc4bdf45 Convert global state to module state
 2 files changed, 212 insertions(+), 345 deletions(-)
0d9b3cb47e Establish global module state and add types to it
 1 file changed, 28 insertions(+), 14 deletions(-)
823767cf9a Convert _sre scanner type to heap type
 1 file changed, 19 insertions(+), 37 deletions(-)
a018a9ce15 Convert _sre match type to heap type
 1 file changed, 31 insertions(+), 43 deletions(-)
7e6e997b59 Convert _sre pattern type to heap type
 1 file changed, 35 insertions(+), 44 deletions(-)
06d23e377c Add convenience macro
 1 file changed, 12 insertions(+)
msg380280 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-03 16:42
In PR 23131, I added a comment to _PyInterpreter_Clear() to remind me that trying to destroy a Python type after the last GC collection doesn't work as expected:

    // All Python types must be destroyed before the last GC collection. Python
    // types create a reference cycle to themselves in their in their
    // PyTypeObject.tp_mro member (the tuple contains the type).
msg380317 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-04 12:59
New changeset 8021875bbcf7385e651def51bc597472a569042c by Victor Stinner in branch 'master':
bpo-1635741: Add PyModule_AddObjectRef() function (GH-23122)
https://github.com/python/cpython/commit/8021875bbcf7385e651def51bc597472a569042c
msg380318 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-04 13:00
I added a new PyModule_AddObjectRef() function which does not steal a reference to the value on success. I suggest to use this new function instead of PyModule_AddObject() which is usually misused (creating reference leaks).
msg380331 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-04 15:34
New changeset 988f1ec8d2643a0d00851903abcdae90d57ac0e6 by Victor Stinner in branch 'master':
bpo-1635741: _contextvars uses PyModule_AddType() (GH-23147)
https://github.com/python/cpython/commit/988f1ec8d2643a0d00851903abcdae90d57ac0e6
msg380332 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-04 15:37
New changeset 18ce7f1d0a3d65f34f25c5964da588743a1bfe3c by Victor Stinner in branch 'master':
bpo-1635741: _ast uses PyModule_AddObjectRef() (GH-23146)
https://github.com/python/cpython/commit/18ce7f1d0a3d65f34f25c5964da588743a1bfe3c
msg380340 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-04 16:33
New changeset 58ca33b4674f39189b03c9a39fa7b676b43b3d08 by Victor Stinner in branch 'master':
bpo-1635741: Fix ref leak in _PyWarnings_Init() error path (GH-23151)
https://github.com/python/cpython/commit/58ca33b4674f39189b03c9a39fa7b676b43b3d08
msg380346 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-04 17:37
New changeset 7184218e186811e75be663be78e57d5302bf8af6 by Mohamed Koubaa in branch 'master':
bpo-1635741: Fix PyInit_pyexpat() error handling (GH-22489)
https://github.com/python/cpython/commit/7184218e186811e75be663be78e57d5302bf8af6
msg380351 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-04 19:32
New changeset 789359f47c2a744caa9a405131706099fd7ad6bd by Erlend Egeberg Aasland in branch 'master':
bpo-1635741: _sqlite3 uses PyModule_AddObjectRef() (GH-23148)
https://github.com/python/cpython/commit/789359f47c2a744caa9a405131706099fd7ad6bd
msg380733 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-11 00:52
New changeset 95ce7cd0a64e7f4739af2d1c158ef69b6980f12a by Victor Stinner in branch 'master':
bpo-1635741: Fix typo in PyModule_AddObjectRef() doc (GH-23234)
https://github.com/python/cpython/commit/95ce7cd0a64e7f4739af2d1c158ef69b6980f12a
msg380758 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-11 13:28
New changeset ba2958ed40d284228836735cbed4a155190e0998 by Victor Stinner in branch 'master':
bpo-40170: Fix PyType_Ready() refleak on static type (GH-23236)
https://github.com/python/cpython/commit/ba2958ed40d284228836735cbed4a155190e0998
msg380854 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-12 22:05
See bpo-27400 for the _datetime module: strptime_module variable is not cleared by Py_Finalize().
msg380857 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-12 22:45
See bpo-42333 for _ssl module. The PR introduces module state and ports the _ssl extension to multiphase initialization.
msg381124 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-16 17:07
For the signal module, see bpo-41713.
msg381300 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-17 22:29
> For the signal module, see bpo-41713.

Done: the _signal module uses again the multi-phase init API.
msg381317 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-18 09:16
$ grep -l -R PyModule_Create . | sort
./_asynciomodule.c
./cjkcodecs/cjkcodecs.h
./cjkcodecs/multibytecodec.c
./_csv.c
./_ctypes/_ctypes.c
./_cursesmodule.c
./_datetimemodule.c
./_decimal/_decimal.c
./_elementtree.c
./gcmodule.c
./grpmodule.c  [*]
./_hashopenssl.c  [*]
./_io/_iomodule.c
./_multiprocessing/posixshmem.c
./ossaudiodev.c
./_pickle.c
./_posixsubprocess.c
./pwdmodule.c  [*]
./pyexpat.c  [*]
./_queuemodule.c
./_randommodule.c
./readline.c
./selectmodule.c
./socketmodule.c
./spwdmodule.c
./_sqlite/module.c
./_sre.c
./_ssl.c  [*]
./_struct.c
./symtablemodule.c
./_testbuffer.c
./_testcapimodule.c
./_testimportmultiple.c
./_testinternalcapi.c
./_threadmodule.c
./_tkinter.c
./_tracemalloc.c
./_xxsubinterpretersmodule.c
./_xxtestfuzz/_xxtestfuzz.c

[*] == open PR
msg381318 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2020-11-18 09:18
For sqlite3, see bpo-42064
msg381351 - (view) Author: miss-islington (miss-islington) Date: 2020-11-18 15:03
New changeset c7011012fac91a30923e39dbce7611f1b3ca8506 by Christian Heimes in branch 'master':
bpo-1635741: Port symtable module to multiphase initialization (GH-23361)
https://github.com/python/cpython/commit/c7011012fac91a30923e39dbce7611f1b3ca8506
msg381352 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-18 15:12
New changeset 46f59ebd01e22cc6a56fd0691217318c1d801a49 by Christian Heimes in branch 'master':
bpo-1635741: Port _hashlib to multiphase initialization (GH-23358)
https://github.com/python/cpython/commit/46f59ebd01e22cc6a56fd0691217318c1d801a49
msg381376 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-18 22:18
New changeset 622307142130d36a30644233441333247838af38 by Victor Stinner in branch 'master':
bpo-1635741: Convert _imp to multi-phase init (GH-23378)
https://github.com/python/cpython/commit/622307142130d36a30644233441333247838af38
msg381379 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-18 23:19
New changeset 6f4635fe20457a7c513050bb117c2f0511cd4e44 by Victor Stinner in branch 'master':
bpo-1635741: Port _warnings to the multi-phase init (GH-23379)
https://github.com/python/cpython/commit/6f4635fe20457a7c513050bb117c2f0511cd4e44
msg381391 - (view) Author: miss-islington (miss-islington) Date: 2020-11-19 07:46
New changeset cc0cd43c0f96dac413e54855e9c77ec4b73bd2f8 by Christian Heimes in branch 'master':
bpo-1635741: Port _random to multiphase initialization (GH-23359)
https://github.com/python/cpython/commit/cc0cd43c0f96dac413e54855e9c77ec4b73bd2f8
msg381392 - (view) Author: miss-islington (miss-islington) Date: 2020-11-19 07:47
New changeset fa2eee975dbf7d2728021ef9d97328bbe88351cf by Christian Heimes in branch 'master':
bpo-1635741: Port grp and pwd to multiphase initialization (GH-23360)
https://github.com/python/cpython/commit/fa2eee975dbf7d2728021ef9d97328bbe88351cf
msg381395 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-19 08:09
About multi-phase init, it's nice to see the list of modules using the "legacy" init API getting smaller at each Python release!

Example adding a log to PyModule_Create2():

+fprintf(stderr, "LEGACY MODULE INIT: %s\n", module->m_name);

python3.6 -c pass: 16 modules using the legacy API

LEGACY MODULE INIT: builtins
LEGACY MODULE INIT: sys
LEGACY MODULE INIT: _warnings
LEGACY MODULE INIT: _imp
LEGACY MODULE INIT: _warnings
LEGACY MODULE INIT: _thread
LEGACY MODULE INIT: _weakref
LEGACY MODULE INIT: io
LEGACY MODULE INIT: marshal
LEGACY MODULE INIT: posix
LEGACY MODULE INIT: zipimport
LEGACY MODULE INIT: _codecs
LEGACY MODULE INIT: _signal
LEGACY MODULE INIT: errno
LEGACY MODULE INIT: _stat

python3.10 -c pass: only 2 modules using the legacy API

LEGACY IMPORT: _thread
LEGACY IMPORT: io

16 (Python 3.6) => 2 (Python 3.10) is a nice progress ;-)
msg381396 - (view) Author: miss-islington (miss-islington) Date: 2020-11-19 08:24
New changeset 3094dd5fb5fa3ed91f5e2887887b193edbc976d2 by Christian Heimes in branch 'master':
bpo-1635741: Port _queue to multiphase initialization (GH-23376)
https://github.com/python/cpython/commit/3094dd5fb5fa3ed91f5e2887887b193edbc976d2
msg381400 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-19 09:54
New changeset bf9d70a1a5255080b7a5e55f319dfffd5f20fdcd by Christian Heimes in branch 'master':
bpo-1635741: Port spwd to multiphase initialization (GH-23390)
https://github.com/python/cpython/commit/bf9d70a1a5255080b7a5e55f319dfffd5f20fdcd
msg381411 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-11-19 13:36
New changeset cfeb5437a8910e28726422a14a93a36584e32238 by Christian Heimes in branch 'master':
bpo-1635741: Port _struct to multiphase initialization (GH-23398)
https://github.com/python/cpython/commit/cfeb5437a8910e28726422a14a93a36584e32238
msg381423 - (view) Author: miss-islington (miss-islington) Date: 2020-11-19 14:08
New changeset 646d7fdefbbc95a83df665698af7385d10bde66c by Christian Heimes in branch 'master':
bpo-1635741: Port gc module to multiphase initialization (GH-23377)
https://github.com/python/cpython/commit/646d7fdefbbc95a83df665698af7385d10bde66c
msg381426 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-19 14:10
$ find -name '*.c' -and -not -name moduleobject.c | xargs grep -l PyModule_Create\( | sort
./Doc/includes/custom2.c
./Doc/includes/custom3.c
./Doc/includes/custom4.c
./Doc/includes/custom.c
./Doc/includes/sublist.c
./Modules/_asynciomodule.c
./Modules/cjkcodecs/multibytecodec.c
./Modules/_csv.c
./Modules/_ctypes/_ctypes.c
./Modules/_cursesmodule.c
./Modules/_datetimemodule.c
./Modules/_decimal/_decimal.c
./Modules/_elementtree.c
./Modules/_io/_iomodule.c
./Modules/_multiprocessing/posixshmem.c
./Modules/ossaudiodev.c
./Modules/_pickle.c
./Modules/_posixsubprocess.c
./Modules/pyexpat.c
./Modules/readline.c
./Modules/selectmodule.c
./Modules/socketmodule.c
./Modules/_sqlite/module.c  [*]
./Modules/_sre.c  [*]
./Modules/_ssl.c  [*]
./Modules/_testbuffer.c
./Modules/_testcapimodule.c
./Modules/_testimportmultiple.c
./Modules/_testinternalcapi.c
./Modules/_threadmodule.c
./Modules/_tkinter.c
./Modules/_tracemalloc.c
./Modules/_xxsubinterpretersmodule.c
./Modules/_xxtestfuzz/_xxtestfuzz.c
./PC/_msi.c
./PC/msvcrtmodule.c
./PC/winreg.c
./PC/winsound.c
./Tools/peg_generator/peg_extension/peg_extension.c
msg381431 - (view) Author: miss-islington (miss-islington) Date: 2020-11-19 14:14
New changeset 588c7c9f08a673472a29e3f8f7fda9e343212e7d by Dong-hee Na in branch 'master':
bpo-1635741: Fix _struct for build bot error (GH-23402)
https://github.com/python/cpython/commit/588c7c9f08a673472a29e3f8f7fda9e343212e7d
msg381432 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-19 14:21
I closed the following issues as duplicates of this issue:

* bpo-15707: "PEP 3121, 384 Refactoring applied to signal module" (duplicate of bpo-41713)
* bpo-15670: "PEP 3121, 384 Refactoring applied to ssl module" (duplicate of bpo-42333)
* bpo-15668: "PEP 3121, 384 Refactoring applied to random module"
* bpo-15675: "PEP 3121, 384 Refactoring applied to array module"
* bpo-15734: "PEP 3121, 384 Refactoring applied to spwd module"
* bpo-15671: "PEP 3121, 384 Refactoring applied to struct module"
* bpo-15705: "PEP 3121, 384 Refactoring applied to sha256 module"
* bpo-15697: "PEP 3121 refactoring applied to pwd module"
* bpo-15714: "PEP 3121, 384 Refactoring applied to grp module"
* bpo-15665: "PEP 3121, 384 refactoring applied to lsprof module"
* bpo-15849: "PEP 3121, 384 Refactoring applied to xx module"
* bpo-15653: "PEP 3121, 384 refactoring applied to hashopenssl module"

See also bpo-15787: "[meta issue] PEP 3121, 384 Refactoring" (still open since it depends on other open issues).
msg381434 - (view) Author: miss-islington (miss-islington) Date: 2020-11-19 15:20
New changeset b437aa83f9374b86b7756705e8dc83b72a99e037 by Christian Heimes in branch 'master':
bpo-1635741: Port _posixshmem extension module to multiphase initialization (GH-23404)
https://github.com/python/cpython/commit/b437aa83f9374b86b7756705e8dc83b72a99e037
msg381476 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-20 10:39
New changeset 2db8e35489d63b976a463fb1d2a6c29f4f965c21 by Mohamed Koubaa in branch 'master':
bpo-1635741: Enhance _datetime error handling (GH-23139)
https://github.com/python/cpython/commit/2db8e35489d63b976a463fb1d2a6c29f4f965c21
msg381477 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-11-20 12:36
New changeset a6109ef68d421712ba368ef502c4789e8de113e0 by Erlend Egeberg Aasland in branch 'master':
bpo-1635741: Convert _sre types to heap types and establish module state (PEP 384) (GH-23393)
https://github.com/python/cpython/commit/a6109ef68d421712ba368ef502c4789e8de113e0
msg381571 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-21 19:28
New changeset 035deee265c7fb227ddc87222fa48761231d8bd7 by Christian Heimes in branch 'master':
bpo-1635741: Port _posixsubprocess module to multiphase init (GH-23406)
https://github.com/python/cpython/commit/035deee265c7fb227ddc87222fa48761231d8bd7
msg381572 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-11-21 19:29
New changeset ea97ebab3578a6e0bb505da96819ac44d422a6cb by Christian Heimes in branch 'master':
bpo-1635741: Port select module to multiphase init (GH-23409)
https://github.com/python/cpython/commit/ea97ebab3578a6e0bb505da96819ac44d422a6cb
msg383155 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-16 11:20
New changeset 8203c73f3bb1f51614279b6e23af2ec587d1fa22 by Victor Stinner in branch 'master':
bpo-1635741: Refactor _threadmodule.c (GH-23793)
https://github.com/python/cpython/commit/8203c73f3bb1f51614279b6e23af2ec587d1fa22
msg383168 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-16 14:08
New changeset fcc6935384b933fbe1a1ef659ed455a3b74c849a by Victor Stinner in branch 'master':
Add symbols of the stable ABI to python3dll.c (GH-23598)
https://github.com/python/cpython/commit/fcc6935384b933fbe1a1ef659ed455a3b74c849a
msg383276 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-18 00:39
New changeset 6104013838e181e3c698cb07316f449a0c31ea96 by Victor Stinner in branch 'master':
bpo-1635741: Port _thread to multiphase init (GH-23811)
https://github.com/python/cpython/commit/6104013838e181e3c698cb07316f449a0c31ea96
msg383283 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-18 00:50
I marked the following issues as duplicates of this one:

* bpo-15651: PEP 3121, 384 refactoring applied to elementtree module
* bpo-15650: PEP 3121, 384 refactoring applied to dbm module
* bpo-15712: PEP 3121, 384 Refactoring applied to unicodedata module
* bpo-15674: PEP 3121, 384 Refactoring applied to _thread module
* bpo-15669: PEP 3121, 384 Refactoring applied to sre module

I also closed bpo-15848 "PEP 3121, 384 Refactoring applied to xxsubtype module" (but not marked it as a duplicate of this one).
msg383285 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-18 00:58
Statistics on C extension modules using the new API (PyModuleDef_Init) / total:

* 3.9: 52 / 120 (43%)
* master: 94 / 119 (79%)

25 extension modules are still using the old API (PyModule_Create).
msg383287 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-18 01:06
> * bpo-15651: PEP 3121, 384 refactoring applied to elementtree module

Oops, this was a mistake. This one is not fixed yet.
msg383454 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-12-20 21:10
These changes introduced a regression in test_curses (see issue42694). And I afraid then introduced regressions in other modules for which there were not purposed tests.
msg383636 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-12-23 07:55
New changeset 6d9ec8bbfa07161431dc6190dd0772a6fbaf7ebd by Christian Heimes in branch 'master':
bpo-1635741: Port resource extension module to module state (GH-23462)
https://github.com/python/cpython/commit/6d9ec8bbfa07161431dc6190dd0772a6fbaf7ebd
msg383785 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-26 00:42
> These changes introduced a regression in test_curses (see issue42694). And I afraid then introduced regressions in other modules for which there were not purposed tests.

In my experience, when a type is modified to prevent creating an instance using type(), there is a test for that. The issue with bpo-42694 is that test_curses is skipped by default, and it might be skipped on buildbots which don't have curses.

(I wrote a fix for bpo-42694, but let's discuss it there.)
msg383799 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-12-26 10:25
The pitfall of PyType_FromModuleAndSpec() is that it makes types instantiable by default if tp_new is not provided. Created objects can crash when you try to use them because they are not properly initialized.

When there was few uses of PyType_FromModuleAndSpec() I fixed them and added tests, but now there are much more types created with PyType_FromModuleAndSpec(). Please check all other uses of PyType_FromModuleAndSpec(), add workarounds and tests.
msg383801 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-26 10:52
I checked for ^.*tp_new.*=.*NULL regex in "git log -p" command output. I checked all commits up to May 8 2016, the commit which added:

+    ((PyTypeObject *)v)->tp_new = NULL;

I met "FlagsType.tp_new = NULL;" multiple times since the code moved multiple times.

Apart of the issue in _curses_panel.panel, I didn't see any other removal by mistake. In this issue, the work started in 2019, so I consider that it's ok. No other tp_new=NULL was removed by mistake.

Again, if tp_new=NULL is used, I suggest to write a function test to ensure that it's not possible to instanciate the type.
msg383844 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-27 11:05
New changeset bf64d9064ab641b1ef9a0c4bda097ebf1204faf4 by Erlend Egeberg Aasland in branch 'master':
bpo-1635741: sqlite3 uses Py_NewRef/Py_XNewRef (GH-23170)
https://github.com/python/cpython/commit/bf64d9064ab641b1ef9a0c4bda097ebf1204faf4
msg383847 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-27 11:43
Progress: 77% (102/132) of extension modules use the new C API.

I used different grep commands to count *all* extension modules, not only the Modules/ directory:

$ grep -E '\<PyModule_Create\>' $(find -name "*.c"|grep -v Doc/|grep -v moduleobject.c)|wc -l
30
$ grep -E '\<PyModuleDef_Init\>' $(find -name "*.c"|grep -v Doc/|grep -v moduleobject.c)|wc -l
102

--

Modules/ directory: 79% (94/119) of extension modules use the new API.

$ grep -E '\<PyModule_Create\>' $(find Modules -name "*.c")|wc -l
25
$ grep -E '\<PyModuleDef_Init\>' $(find Modules -name "*.c")|wc -l
94
msg383880 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-28 02:09
New changeset 897387d2c8a956e74770c6bdd0447dfec61e8e27 by Erlend Egeberg Aasland in branch 'master':
bpo-1635741: sqlite3: Fix ref leak introduced by commit bf64d90 (GH-23972)
https://github.com/python/cpython/commit/897387d2c8a956e74770c6bdd0447dfec61e8e27
msg384039 - (view) Author: Paulo Henrique Silva (phsilva) * Date: 2020-12-30 01:06
Repeated msg355187 testing on master[056c08211b].

---
#include <Python.h>

void func()
{
    Py_Initialize(); Py_Finalize();
    Py_ssize_t cnt = _Py_GetRefTotal();
    printf("sys.gettotalrefcount(): %zd\n", cnt);
}

int main(int argc, char *argv[])
{
    Py_SetProgramName(L"./_testembed");
    for (int i=0; i < 10; i++) {
        func();
    }
}
---

No refs leaking anymore!?

---
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241
sys.gettotalrefcount(): 10241

---
msg384042 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-12-30 01:24
> No refs leaking anymore!?

Well, there is another test:

$ ./python -X showrefcount -c pass
[23547 refs, 6589 blocks]

Python still leaks 23547 refs at exit.
msg384326 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-01-04 14:34
New changeset c8a87addb1fa35dec79ed8f227eba3694fc36234 by Mohamed Koubaa in branch 'master':
bpo-1635741: Port pyexpat to multi-phase init (PEP 489) (GH-22222)
https://github.com/python/cpython/commit/c8a87addb1fa35dec79ed8f227eba3694fc36234
msg384352 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-01-04 21:33
New changeset 0b858cdd5d114f0890b11b6c4d6559d0ceb468ab by Erlend Egeberg Aasland in branch 'master':
bpo-1635741: Convert _multibytecodec to multi-phase init (GH-24095)
https://github.com/python/cpython/commit/0b858cdd5d114f0890b11b6c4d6559d0ceb468ab
msg384646 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-01-08 09:32
> New changeset 0b858cdd5d114f0890b11b6c4d6559d0ceb468ab by Erlend Egeberg Aasland in branch 'master':
> bpo-1635741: Convert _multibytecodec to multi-phase init (GH-24095)

This change introduced two regressions:

* bpo-42846: "Using _multibytecodec module on Windows, test_threading/embed get failure" (FIXED)
* bpo-42866: "test test_multibytecodec: Test_IncrementalEncoder.test_subinterp() leaks references"
msg384978 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-01-12 21:36
In GH-23598, PyModule_AddObjectRef was added as EXPORT_DATA. Shouldn't it be EXPORT_FUNC?
msg384987 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-01-13 00:04
> In GH-23598, PyModule_AddObjectRef was added as EXPORT_DATA. Shouldn't it be EXPORT_FUNC?

Oh, I didn't notice that there was EXPORT_DATA. Right, EXPORT_FUNC must be used.
msg385010 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-01-13 10:15
New changeset 2396614b8958ad202378fd71a598eb4106ac5896 by Dong-hee Na in branch 'master':
bpo-1635741: Fix PyModule_AddObjectRef to use EXPORT_FUNC (GH-24205)
https://github.com/python/cpython/commit/2396614b8958ad202378fd71a598eb4106ac5896
msg388728 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-03-15 12:03
I marked bpo-15698 "PEP 3121, 384 Refactoring applied to pyexpat module" as a duplicate of this issue.
msg410809 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-17 17:23
> I wrote PR 20763 to "finalize" static types in Py_Finalize(). It mostly works, but "./Programs/_testembed test_forced_io_encoding" crash. (...)

I created bpo-46417 follow-up issue: "[subinterpreters] Clear static types in Py_Finalize()".
msg411116 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-21 12:05
Using "./python -IsS" command, sys.modules now only has 3 extensions which are not created by PyModuleDef_Init():

* builtins
* _io
* sys

The builtins and sys extensions use many static types. Converting these static types to heap types is blocked by bpo-40601. Soon, bpo-46417 will clear these types. Py_Finalize() does its best to clear explicitly builtins and sys namespaces.
msg411278 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-22 18:46
In bpo-46417, I pushed a change to call _PyDebug_PrintTotalRefs() after destroying the interpreter. I backported locally this change to other Python versions to compare the progress on old Python versions:

./python -I -X showrefcount -c pass command:

* Python 3.7: [22636 refs, 7453 blocks]
* Python 3.8: [18082 refs, 5867 blocks]
* Python 3.9: [17786 refs, 5766 blocks]
* Python 3.10: [10725 refs, 3978 blocks]
* current main branch: [2957 refs, 1240 blocks]

Yeah, main is way better than Python 3.10! I pushed many changes in 
bpo-46417 to clear most static types, it helps a lot!
msg411311 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-23 00:06
My work on bpo-46417 reduces the number of leak references from around 10k to ... minus 4 references :-) Clearing static types and a few "static" objects helped a lot!

> New changeset a1444f43584af0f7a0af72aa06ba0a86ae5a87a2 by Victor Stinner in branch 'main':
> bpo-46417: Fix _PyStaticType_Dealloc() (GH-30810)
> https://github.com/python/cpython/commit/a1444f43584af0f7a0af72aa06ba0a86ae5a87a2

At commit a1444f43584af0f7a0af72aa06ba0a86ae5a87a2, I get:

    $ ./python -I -X showrefcount -c pass
    [-4 refs, 61 blocks]

I have to investigate why it's negative. It may be caused by bpo-46449 issue.

See also: https://bugs.python.org/issue46417#msg411307
msg411872 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-27 13:42
Thanks to recent enhancements, epecially in bpo-46417, the last memory blocks are now released at Python exit! The initial issue has been fixed!!! This bug was 15 years old! Current main branch:

$ ./python -I -X showrefcount -c pass
[-5 refs, 0 blocks]

"0 blocks" means that Python no longer leaks memory at exit. You can use Valgrind to check it ;-)

The negative reference count is being discussed in bpo-46449.

I close this issue since it has an insane history: too many pull requests, changes, etc.

While the work is not 100% done (we need to convert remaining static types to heap types, and convert extensions to multi-phase init), I prefer to address remaining issues in (existing or new) separated issues. See for example the bpo-40077: "Convert static types to heap types: use PyType_FromSpec()".

I would like to thank everybody who helped to fix this issue! It's hard to list all names since this issue is a meta issues made of many sub-issues which also have sub-issues. Authors of PEP 573 and PEP 630 also helped fixing this issue!
msg411961 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-28 02:24
I marked bpo-35774 as a duplicate of this issue.
msg411997 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-28 13:55
The negative refcount issue has been fixed ;-)

At commit 9a241271139a317597aca71d5971346b2cfe7dbd, Python now leaks exactly 0 reference count and 0 memory block at exit:

$ ./python -I -X showrefcount -c pass
[0 refs, 0 blocks]
msg413938 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-02-24 23:03
New changeset c9c178fdb1af01e441a6c83f3a21a67e5dd9f17d by Victor Stinner in branch 'main':
bpo-1635741: test_embed cheks that Python does not leak (GH-31555)
https://github.com/python/cpython/commit/c9c178fdb1af01e441a6c83f3a21a67e5dd9f17d
msg413979 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-02-25 11:34
New changeset 4657bf701670215ce69b89401b2307022a3b0a7d by Victor Stinner in branch 'main':
bpo-1635741: Fix winreg reference leaks (GH-31560)
https://github.com/python/cpython/commit/4657bf701670215ce69b89401b2307022a3b0a7d
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44470
2022-02-25 11:34:18vstinnersetmessages: + msg413979
2022-02-25 02:02:59vstinnersetpull_requests: + pull_request29683
2022-02-24 23:03:24vstinnersetmessages: + msg413938
2022-02-24 17:02:37vstinnersetpull_requests: + pull_request29677
2022-01-28 13:55:58vstinnersetmessages: + msg411997
2022-01-28 02:24:38vstinnersetmessages: + msg411961
2022-01-28 02:24:27vstinnerlinkissue35774 superseder
2022-01-27 13:42:43vstinnersetstatus: open -> closed
versions: + Python 3.11, - Python 3.10
messages: + msg411872

resolution: fixed
stage: patch review -> resolved
2022-01-23 00:06:27vstinnersetmessages: + msg411311
2022-01-22 18:46:24vstinnersetmessages: + msg411278
2022-01-21 12:05:18vstinnersetmessages: + msg411116
2022-01-21 11:40:24vstinnersetpull_requests: + pull_request28932
2022-01-17 17:23:56vstinnersetmessages: + msg410809
2022-01-11 03:54:02kumaradityasetnosy: + kumaraditya
pull_requests: + pull_request28726
2022-01-11 01:07:46CharlieZhaosetnosy: + CharlieZhao
pull_requests: + pull_request28723
2021-11-04 14:17:21erlendaaslandsetnosy: + amaury.forgeotdarc, orsenthil, kylotan, vstinner, christian.heimes, tlesher, phsilva, petr.viktorin, ysj.ray, santoso.wijaya, lukasz.langa, python-dev, eric.snow, serhiy.storchaka, pconnell, isoschiz, Jim Fasarakis-Hilliard, corona10, miss-islington, shihai1991, koubaa, h-vetinari, TCsaba
2021-11-04 14:16:35erlendaaslandsetassignee: docs@python ->

nosy: + erlendaasland, - docs@python, ahmedsayeed1982
components: + Interpreter Core, Subinterpreters, - Documentation
versions: + Python 3.10, - Python 3.6
2021-11-04 14:14:59erlendaaslandsetmessages: - msg405698
2021-11-04 12:10:18ahmedsayeed1982setversions: + Python 3.6, - Python 3.10
nosy: + docs@python, ahmedsayeed1982, - amaury.forgeotdarc, orsenthil, kylotan, vstinner, christian.heimes, tlesher, phsilva, petr.viktorin, ysj.ray, santoso.wijaya, lukasz.langa, python-dev, eric.snow, serhiy.storchaka, serhiy.storchaka, pconnell, isoschiz, Jim Fasarakis-Hilliard, corona10, miss-islington, shihai1991, erlendaasland, koubaa, h-vetinari, TCsaba

messages: + msg405698

assignee: docs@python
components: + Documentation, - Interpreter Core, Subinterpreters
2021-06-29 17:30:52h-vetinarisetnosy: + h-vetinari
2021-05-01 21:34:52TCsabasetnosy: + TCsaba
2021-03-15 12:03:25vstinnersetmessages: + msg388728
2021-03-15 12:02:46vstinnerlinkissue15698 superseder
2021-01-13 10:15:49corona10setmessages: + msg385010
2021-01-13 06:14:57corona10setpull_requests: + pull_request23031
2021-01-13 00:04:13vstinnersetmessages: + msg384987
2021-01-12 21:36:18petr.viktorinsetmessages: + msg384978
2021-01-08 22:44:05erlendaaslandsetpull_requests: + pull_request23002
2021-01-08 09:32:59vstinnersetmessages: + msg384646
2021-01-04 21:33:53vstinnersetmessages: + msg384352
2021-01-04 14:34:37vstinnersetmessages: + msg384326
2021-01-04 14:29:42erlendaaslandsetpull_requests: + pull_request22926
2020-12-30 01:24:06vstinnersetmessages: + msg384042
2020-12-30 01:06:37phsilvasetmessages: + msg384039
2020-12-28 02:09:42vstinnersetmessages: + msg383880
2020-12-27 22:56:52erlendaaslandsetpull_requests: + pull_request22817
2020-12-27 11:43:54vstinnersetmessages: + msg383847
2020-12-27 11:05:59vstinnersetmessages: + msg383844
2020-12-26 10:52:39vstinnersetmessages: + msg383801
2020-12-26 10:25:42serhiy.storchakasetmessages: + msg383799
2020-12-26 00:42:13vstinnersetmessages: + msg383785
2020-12-23 07:55:41christian.heimessetmessages: + msg383636
2020-12-20 21:10:44serhiy.storchakasetmessages: + msg383454
2020-12-18 01:06:40vstinnersetmessages: + msg383287
2020-12-18 01:06:06vstinnerunlinkissue15651 superseder
2020-12-18 00:58:46vstinnersetmessages: + msg383285
2020-12-18 00:50:16vstinnersetmessages: + msg383283
2020-12-18 00:49:01vstinnerlinkissue15669 superseder
2020-12-18 00:45:03vstinnerlinkissue15651 superseder
2020-12-18 00:43:53vstinnerlinkissue15650 superseder
2020-12-18 00:40:14vstinnerlinkissue15674 superseder
2020-12-18 00:39:08vstinnersetmessages: + msg383276
2020-12-16 23:25:26vstinnersetpull_requests: + pull_request22671
2020-12-16 14:08:32vstinnersetmessages: + msg383168
2020-12-16 11:20:41vstinnersetmessages: + msg383155
2020-12-16 08:50:01vstinnersetpull_requests: + pull_request22649
2020-12-01 15:10:09vstinnersetpull_requests: + pull_request22465
2020-11-28 01:35:23koubaasetpull_requests: + pull_request22417
2020-11-24 13:04:32orsenthilsetnosy: + orsenthil
2020-11-23 10:06:12serhiy.storchakasetnosy: + serhiy.storchaka
pull_requests: + pull_request22366
2020-11-23 10:06:10serhiy.storchakasetnosy: + serhiy.storchaka
pull_requests: + pull_request22365
2020-11-22 12:48:53christian.heimessetpull_requests: + pull_request22354
2020-11-21 19:29:29christian.heimessetmessages: + msg381572
2020-11-21 19:28:23christian.heimessetmessages: + msg381571
2020-11-20 12:36:31corona10setmessages: + msg381477
2020-11-20 10:39:48vstinnersetmessages: + msg381476
2020-11-19 17:16:25christian.heimessetpull_requests: + pull_request22302
2020-11-19 15:55:48christian.heimessetpull_requests: + pull_request22299
2020-11-19 15:20:52miss-islingtonsetmessages: + msg381434
2020-11-19 14:35:24christian.heimessetpull_requests: + pull_request22297
2020-11-19 14:21:21vstinnersetmessages: + msg381432
2020-11-19 14:14:43miss-islingtonsetmessages: + msg381431
2020-11-19 14:14:40vstinnerlinkissue15653 superseder
2020-11-19 14:13:36vstinnerlinkissue15849 superseder
2020-11-19 14:10:28vstinnerlinkissue15665 superseder
2020-11-19 14:10:15christian.heimessetmessages: + msg381426
2020-11-19 14:09:27vstinnerlinkissue15714 superseder
2020-11-19 14:08:47vstinnerlinkissue15697 superseder
2020-11-19 14:08:43miss-islingtonsetmessages: + msg381423
2020-11-19 14:07:55vstinnerlinkissue15705 superseder
2020-11-19 14:07:00vstinnerlinkissue15671 superseder
2020-11-19 14:06:10vstinnerlinkissue15734 superseder
2020-11-19 14:02:17vstinnerlinkissue15675 superseder
2020-11-19 14:01:02vstinnerlinkissue15668 superseder
2020-11-19 13:52:12corona10setpull_requests: + pull_request22294
2020-11-19 13:48:04corona10setpull_requests: + pull_request22293
2020-11-19 13:36:26corona10setmessages: + msg381411
2020-11-19 11:09:06christian.heimessetpull_requests: + pull_request22290
2020-11-19 09:54:14christian.heimessetmessages: + msg381400
2020-11-19 09:03:04erlendaaslandsetpull_requests: + pull_request22285
2020-11-19 08:24:45miss-islingtonsetmessages: + msg381396
2020-11-19 08:18:01christian.heimessetpull_requests: + pull_request22282
2020-11-19 08:09:45vstinnersetmessages: + msg381395
2020-11-19 07:47:35miss-islingtonsetmessages: + msg381392
2020-11-19 07:46:33miss-islingtonsetmessages: + msg381391
2020-11-18 23:19:13vstinnersetmessages: + msg381379
2020-11-18 23:12:58vstinnersetpull_requests: + pull_request22273
2020-11-18 22:47:12vstinnersetpull_requests: + pull_request22272
2020-11-18 22:18:38vstinnersetmessages: + msg381376
2020-11-18 21:10:55vstinnersetpull_requests: + pull_request22271
2020-11-18 19:34:33christian.heimessetpull_requests: + pull_request22270
2020-11-18 19:12:41christian.heimessetpull_requests: + pull_request22269
2020-11-18 15:12:21christian.heimessetmessages: + msg381352
2020-11-18 15:03:58miss-islingtonsetmessages: + msg381351
2020-11-18 09:55:28christian.heimessetpull_requests: + pull_request22254
2020-11-18 09:18:13erlendaaslandsetmessages: + msg381318
2020-11-18 09:16:18christian.heimessetmessages: + msg381317
2020-11-18 08:48:55christian.heimessetpull_requests: + pull_request22253
2020-11-18 08:18:04christian.heimessetpull_requests: + pull_request22252
2020-11-18 07:49:46christian.heimessetpull_requests: + pull_request22251
2020-11-17 22:29:42vstinnersetmessages: + msg381300
2020-11-16 17:07:56vstinnersetmessages: + msg381124
2020-11-15 19:01:44koubaasetpull_requests: + pull_request22195
2020-11-12 22:45:52christian.heimessetnosy: + christian.heimes
messages: + msg380857
2020-11-12 22:05:33vstinnersetmessages: + msg380854
2020-11-11 13:28:00vstinnersetmessages: + msg380758
2020-11-11 12:41:32vstinnersetpull_requests: + pull_request22134
2020-11-11 00:52:35vstinnersetmessages: + msg380733
2020-11-11 00:32:43vstinnersetpull_requests: + pull_request22131
2020-11-07 03:13:07koubaasetpull_requests: + pull_request22092
2020-11-07 03:08:45koubaasetpull_requests: + pull_request22091
2020-11-05 18:51:46erlendaaslandsetpull_requests: + pull_request22082
2020-11-04 19:32:02vstinnersetmessages: + msg380351
2020-11-04 17:37:29vstinnersetmessages: + msg380346
2020-11-04 16:33:16vstinnersetmessages: + msg380340
2020-11-04 15:45:48christian.heimessetnosy: - christian.heimes
2020-11-04 15:44:24vstinnersetpull_requests: + pull_request22063
2020-11-04 15:37:14vstinnersetmessages: + msg380332
2020-11-04 15:34:04vstinnersetmessages: + msg380331
2020-11-04 14:43:21erlendaaslandsetpull_requests: + pull_request22060
2020-11-04 14:17:32vstinnersetpull_requests: + pull_request22059
2020-11-04 14:07:32vstinnersetpull_requests: + pull_request22058
2020-11-04 13:00:44vstinnersetmessages: + msg380318
2020-11-04 12:59:24vstinnersetmessages: + msg380317
2020-11-03 16:42:45vstinnersetmessages: + msg380280
2020-11-03 11:37:02erlendaaslandsetmessages: + msg380270
2020-11-03 10:51:33vstinnersetpull_requests: + pull_request22038
2020-11-02 12:11:09vstinnersetmessages: + msg380216
2020-11-02 02:50:44koubaasetpull_requests: + pull_request22007
2020-10-26 15:43:55vstinnersetmessages: + msg379667
2020-10-22 10:20:44miss-islingtonsetmessages: + msg379287
2020-10-22 08:09:09christian.heimessetpull_requests: + pull_request21821
2020-10-22 08:06:09christian.heimessetnosy: + christian.heimes
messages: + msg379280
2020-10-20 21:44:56petr.viktorinsetnosy: + petr.viktorin
pull_requests: + pull_request21792
2020-10-15 14:24:49vstinnersetpull_requests: + pull_request21680
2020-10-15 14:22:28vstinnersetmessages: + msg378685
2020-10-15 13:57:08vstinnersetpull_requests: + pull_request21679
2020-10-06 11:28:16vstinnersetmessages: + msg378115
2020-10-02 03:06:24koubaasetpull_requests: + pull_request21507
2020-10-02 02:48:15koubaasetpull_requests: + pull_request21506
2020-10-01 15:08:15erlendaaslandsetnosy: + erlendaasland
pull_requests: + pull_request21497
2020-09-26 10:56:33corona10setmessages: + msg377523
2020-09-26 05:44:40corona10setpull_requests: + pull_request21451
2020-09-23 10:38:20vstinnersetmessages: + msg377365
2020-09-23 10:33:49vstinnersetmessages: + msg377364
2020-09-21 12:40:45vstinnersetmessages: + msg377253
2020-09-20 02:20:49koubaasetpull_requests: + pull_request21372
2020-09-16 14:08:25vstinnersetmessages: + msg376993
2020-09-14 18:41:27koubaasetpull_requests: + pull_request21297
2020-09-14 14:17:16koubaasetpull_requests: + pull_request21296
2020-09-13 00:22:31koubaasetpull_requests: + pull_request21277
2020-09-12 23:35:42koubaasetpull_requests: + pull_request21275
2020-09-10 14:09:12vstinnersetmessages: + msg376687
2020-09-09 03:28:57corona10setmessages: + msg376616
2020-09-09 02:59:29koubaasetpull_requests: + pull_request21239
2020-09-09 01:41:01koubaasetpull_requests: + pull_request21238
2020-09-08 13:33:56vstinnersetmessages: + msg376572
2020-09-08 13:33:35vstinnersetmessages: + msg376571
2020-09-08 12:03:11vstinnersetmessages: + msg376567
2020-09-08 11:56:04vstinnersetpull_requests: + pull_request21231
2020-09-08 11:51:37vstinnersetpull_requests: + pull_request21230
2020-09-08 11:45:39vstinnersetmessages: + msg376566
2020-09-08 09:16:18vstinnersetmessages: + msg376556
2020-09-08 09:07:48vstinnersetmessages: + msg376555
2020-09-08 09:00:36vstinnersetmessages: + msg376554
2020-09-08 09:00:17vstinnerlinkissue15709 superseder
2020-09-08 08:59:20vstinnersetmessages: + msg376552
2020-09-08 01:43:51koubaasetpull_requests: + pull_request21227
2020-09-07 16:35:37koubaasetpull_requests: + pull_request21223
2020-09-07 15:14:35vstinnersetmessages: + msg376500
2020-09-07 14:46:28koubaasetpull_requests: + pull_request21216
2020-09-07 14:02:55vstinnersetmessages: + msg376493
2020-09-07 14:01:50vstinnerlinkissue15662 superseder
2020-09-07 13:55:42vstinnerlinkissue15681 superseder
2020-09-07 13:55:38vstinnerlinkissue31862 superseder
2020-09-07 13:51:47koubaasetpull_requests: + pull_request21212
2020-09-07 13:50:24vstinnerlinkissue15704 superseder
2020-09-07 13:50:05vstinnerlinkissue15706 superseder
2020-09-07 13:48:02vstinnerlinkissue15680 superseder
2020-09-07 13:46:46vstinnerlinkissue15733 superseder
2020-09-07 13:43:50vstinnerlinkissue15686 superseder
2020-09-07 13:12:44vstinnersetmessages: + msg376480
2020-09-07 08:49:06vstinnersetmessages: + msg376477
2020-09-07 08:28:03vstinnersetmessages: + msg376474
2020-09-06 10:10:21vstinnersetmessages: + msg376461
2020-09-04 11:52:09vstinnersetmessages: + msg376360
2020-09-03 08:21:25vstinnersetmessages: + msg376288
2020-09-02 14:28:25vstinnersetmessages: + msg376240
versions: + Python 3.10, - Python 3.9
2020-09-02 09:55:26vstinnersetmessages: + msg376221
2020-09-02 09:45:27vstinnersetmessages: + msg376218
2020-09-01 22:23:51koubaasetpull_requests: + pull_request21148
2020-09-01 22:11:42koubaasetpull_requests: + pull_request21147
2020-09-01 22:10:38koubaasetpull_requests: + pull_request21146
2020-08-29 16:25:54koubaasetpull_requests: + pull_request21109
2020-08-29 01:54:53koubaasetpull_requests: + pull_request21101
2020-08-28 02:17:47koubaasetpull_requests: + pull_request21095
2020-08-28 00:41:44koubaasetpull_requests: + pull_request21094
2020-08-17 20:36:27vstinnersetmessages: + msg375567
2020-08-17 14:43:49shihai1991setpull_requests: + pull_request21022
2020-08-16 03:44:19shihai1991setpull_requests: + pull_request21015
2020-08-13 14:23:17vstinnersetmessages: + msg375311
2020-08-13 12:23:30koubaasetpull_requests: + pull_request20983
2020-08-13 12:23:04koubaasetpull_requests: + pull_request20982
2020-08-13 04:46:06shihai1991setmessages: + msg375290
2020-08-12 21:56:51vstinnersetmessages: + msg375288
2020-08-12 21:23:37vstinnersetmessages: + msg375287
2020-08-12 21:17:59vstinnersetmessages: + msg375286
2020-08-12 17:45:24shihai1991setmessages: + msg375272
2020-08-11 10:32:50vstinnersetmessages: + msg375169
2020-08-10 21:12:38koubaasetpull_requests: + pull_request20949
2020-07-24 13:13:29shihai1991setpull_requests: + pull_request20746
2020-07-09 15:53:52koubaasetpull_requests: + pull_request20567
2020-07-07 21:12:52koubaasetpull_requests: + pull_request20522
2020-07-07 18:00:05koubaasetpull_requests: + pull_request20521
2020-07-07 14:01:34koubaasetpull_requests: + pull_request20519
2020-07-04 21:41:03koubaasetnosy: + koubaa
pull_requests: + pull_request20471
2020-07-03 16:36:54corona10setmessages: + msg372942
2020-07-03 14:59:20vstinnersetmessages: + msg372938
2020-07-03 14:11:00corona10setpull_requests: + pull_request20443
2020-07-03 09:00:14corona10setmessages: + msg372912
2020-07-01 23:21:21vstinnersetpull_requests: + pull_request20420
2020-07-01 23:20:03vstinnersetmessages: + msg372797
2020-07-01 22:17:13vstinnersetpull_requests: + pull_request20419
2020-06-27 22:42:51python-devsetnosy: + python-dev
pull_requests: + pull_request20343
2020-06-26 13:29:12corona10setpull_requests: + pull_request20326
2020-06-23 15:51:47shihai1991setpull_requests: + pull_request20253
2020-06-22 16:58:26vstinnersetmessages: + msg372103
2020-06-22 16:57:12vstinnersetmessages: + msg372102
2020-06-22 15:53:14corona10setmessages: + msg372096
2020-06-22 09:35:12vstinnersetmessages: + msg372077
2020-06-22 09:22:23vstinnersetmessages: + msg372061
2020-06-16 16:41:34corona10setmessages: + msg371683
2020-06-16 15:57:44corona10setpull_requests: + pull_request20099
2020-06-15 16:21:03corona10setmessages: + msg371569
2020-06-13 01:47:21corona10setpull_requests: + pull_request20041
2020-06-11 14:27:17corona10setpull_requests: + pull_request20005
2020-06-09 16:10:36vstinnersetmessages: + msg371119
2020-06-09 16:08:00vstinnersetpull_requests: + pull_request19962
2020-06-05 15:01:09corona10setmessages: + msg370763
2020-06-01 16:12:31corona10setmessages: + msg370561
2020-05-31 14:08:38Jim Fasarakis-Hilliardsetnosy: + Jim Fasarakis-Hilliard
2020-05-30 14:29:34corona10setpull_requests: + pull_request19783
2020-05-18 13:05:53vstinnersetcomponents: + Subinterpreters
2020-05-07 01:17:23corona10setmessages: + msg368318
2020-05-05 12:19:46corona10setpull_requests: + pull_request19238
2020-05-05 01:49:52corona10setmessages: + msg368096
2020-05-04 18:39:07corona10setpull_requests: + pull_request19222
2020-04-30 22:44:06vstinnersetmessages: + msg367796
2020-04-30 21:01:40vstinnersetpull_requests: + pull_request19142
2020-04-29 18:20:34corona10setmessages: + msg367686
2020-04-29 16:45:27corona10setpull_requests: + pull_request19119
2020-04-10 15:09:27corona10setpull_requests: + pull_request18815
2020-04-05 03:34:49corona10setpull_requests: + pull_request18745
2020-04-04 17:51:43corona10setpull_requests: - pull_request18728
2020-04-04 17:41:31corona10setpull_requests: + pull_request18728
2020-04-02 18:00:56vstinnersetmessages: + msg365611
2020-04-02 15:30:23shihai1991setpull_requests: + pull_request18669
2020-04-02 12:35:26vstinnersetmessages: + msg365584
2020-04-01 15:12:34vstinnersetmessages: + msg365484
2020-03-31 16:17:39shihai1991setpull_requests: + pull_request18610
2020-03-31 14:33:29vstinnersetmessages: + msg365388
2020-03-31 13:20:32corona10setpull_requests: + pull_request18602
2020-03-31 12:43:53vstinnersetmessages: + msg365386
2020-03-31 12:14:26corona10setpull_requests: + pull_request18601
2020-03-26 01:26:13vstinnersetmessages: + msg365043
2020-03-25 19:22:48shihai1991setmessages: + msg365017
2020-03-25 18:17:35kylotansetmessages: + msg365008
2020-03-25 12:54:50vstinnersetmessages: + msg364987
2020-03-25 03:23:33phsilvasetmessages: + msg364975
2020-03-25 02:41:53vstinnersetmessages: + msg364973
2020-03-25 02:20:06vstinnersetmessages: + msg364972
2020-03-25 02:18:53vstinnersetmessages: + msg364971
2020-03-25 01:46:40phsilvasetmessages: + msg364968
2020-03-25 01:28:25phsilvasetpull_requests: + pull_request18512
2020-03-25 01:18:23phsilvasetpull_requests: + pull_request18511
2020-03-24 17:34:09Alex Budovskisetnosy: - Alex Budovski
2020-03-24 17:32:49vstinnersetmessages: + msg364952
2020-03-24 17:31:25vstinnersetmessages: + msg364951
2020-03-24 17:05:25vstinnersetpull_requests: + pull_request18501
2020-03-24 15:23:47vstinnersetpull_requests: + pull_request18497
2020-03-23 23:48:06vstinnersetmessages: + msg364909
2020-03-23 22:45:33vstinnersetpull_requests: + pull_request18489
2020-03-23 22:42:55vstinnersetmessages: + msg364906
2020-03-23 18:58:31vstinnersetmessages: + msg364883
2020-03-23 18:31:28phsilvasetpull_requests: + pull_request18483
2020-03-23 18:15:55shihai1991setmessages: + msg364871
2020-03-23 11:45:45lukasz.langasetnosy: + lukasz.langa
messages: + msg364845
2020-03-23 05:15:30shihai1991setmessages: + msg364836
2020-03-23 01:44:12phsilvasetmessages: + msg364833
2020-03-22 04:03:53phsilvasetpull_requests: + pull_request18468
2020-03-21 10:00:25shihai1991setpull_requests: + pull_request18460
2020-03-20 08:16:58vstinnersetmessages: + msg364656
2020-03-20 05:31:01shihai1991setpull_requests: + pull_request18444
2020-03-19 16:16:12vstinnersetmessages: + msg364609
2020-03-19 15:22:01corona10setpull_requests: + pull_request18430
2020-03-19 14:35:23corona10setpull_requests: + pull_request18426
2020-03-19 10:40:07shihai1991setpull_requests: + pull_request18423
2020-03-18 14:29:38vstinnersetmessages: + msg364521
2020-03-18 10:50:30corona10setpull_requests: + pull_request18409
2020-03-17 17:46:32vstinnersetmessages: + msg364463
2020-03-17 15:18:25corona10setpull_requests: + pull_request18395
2020-03-17 01:15:32vstinnersetmessages: + msg364379
2020-03-16 15:10:28vstinnersetmessages: + msg364330
2020-03-15 19:39:25miss-islingtonsetpull_requests: + pull_request18371
2020-03-15 19:39:20miss-islingtonsetpull_requests: + pull_request18370
2020-03-15 14:12:53shihai1991setpull_requests: + pull_request18367
2020-03-15 14:02:30shihai1991setmessages: + msg364234
2020-03-15 11:53:21corona10setnosy: + corona10
pull_requests: + pull_request18363
2020-03-15 07:38:55shihai1991setpull_requests: + pull_request18359
2020-03-11 16:56:21vstinnersetmessages: + msg363941
2020-03-11 16:53:30vstinnersetmessages: + msg363940
2020-03-11 16:50:59vstinnersetmessages: + msg363937
2020-03-11 16:49:15vstinnersetmessages: + msg363936
2020-03-11 16:46:10vstinnersetmessages: + msg363935
2020-02-25 09:04:42phsilvasetnosy: + phsilva
2020-02-23 07:38:38shihai1991setpull_requests: + pull_request17978
2020-02-22 14:31:56shihai1991setpull_requests: + pull_request17974
2020-02-18 11:17:45miss-islingtonsetmessages: + msg362195
2020-02-17 13:50:39vstinnersetmessages: + msg362144
2020-02-17 13:49:33vstinnersetmessages: + msg362143
2020-02-17 09:11:37vstinnersetmessages: + msg362124
2020-02-16 12:56:28shihai1991setmessages: + msg362068
2020-02-12 14:31:44shihai1991setpull_requests: + pull_request17859
2020-02-11 11:16:45miss-islingtonsetnosy: + miss-islington
messages: + msg361798
2020-02-07 17:38:13eric.snowsetnosy: + eric.snow
2020-02-07 12:55:50shihai1991setpull_requests: + pull_request17780
2020-02-06 08:57:42shihai1991setpull_requests: + pull_request17750
2020-02-06 01:21:01shihai1991setmessages: + msg361466
2020-02-05 13:17:36shihai1991setmessages: + msg361428
2020-02-05 13:15:21shihai1991setmessages: + msg361427
2020-02-05 12:50:11shihai1991setpull_requests: + pull_request17740
2020-02-05 07:54:13shihai1991setpull_requests: + pull_request17733
2020-01-19 11:25:02shihai1991setpull_requests: + pull_request17457
2020-01-19 11:02:16shihai1991setpull_requests: + pull_request17456
2020-01-18 11:05:22shihai1991setpull_requests: + pull_request17445
2020-01-18 10:45:16shihai1991setpull_requests: + pull_request17444
2020-01-16 16:27:33shihai1991setpull_requests: + pull_request17428
2020-01-16 11:57:57shihai1991setpull_requests: + pull_request17425
2020-01-15 16:32:55vstinnersetmessages: + msg360063
2020-01-12 03:11:46shihai1991setmessages: + msg359830
2020-01-07 00:41:22shihai1991setmessages: + msg359482
2020-01-07 00:36:19shihai1991setpull_requests: + pull_request17299
2020-01-05 13:30:21shihai1991setnosy: + shihai1991
messages: + msg359342
2020-01-05 13:28:20shihai1991setkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request17262
2019-10-23 00:32:00vstinnersetmessages: + msg355201
2019-10-23 00:31:44vstinnerlinkissue32026 superseder
2019-10-23 00:19:27vstinnersetmessages: + msg355194
2019-10-23 00:17:06vstinnersetmessages: + msg355193
2019-10-23 00:16:52vstinnerlinkissue21387 superseder
2019-10-23 00:16:01vstinnersetmessages: + msg355191
2019-10-23 00:15:53vstinnerlinkissue26888 superseder
2019-10-23 00:12:59vstinnersetmessages: + msg355189
2019-10-23 00:12:45vstinnerlinkissue6741 superseder
2019-10-23 00:11:30vstinnersetnosy: + vstinner
title: Interpreter seems to leak references after finalization -> Py_Finalize() doesn't clear all Python objects at exit
messages: + msg355187

versions: + Python 3.9, - Python 3.1, Python 2.7, Python 3.2
2015-08-18 06:20:57Alex Budovskisetnosy: + Alex Budovski
messages: + msg248761
2014-02-03 18:32:01BreamoreBoysetnosy: - BreamoreBoy
2013-04-20 10:04:07isoschizsetnosy: + pconnell, isoschiz
2011-03-31 11:49:57tleshersetnosy: + tlesher
2011-03-13 09:18:08santoso.wijayasetnosy: + santoso.wijaya
2011-03-13 07:12:36ysj.raysetnosy: amaury.forgeotdarc, kylotan, ysj.ray, BreamoreBoy
messages: + msg130729
2011-02-14 03:07:28ysj.raysetnosy: + ysj.ray
2010-07-21 10:21:13amaury.forgeotdarclinkissue8258 superseder
2010-07-21 09:20:21amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg111024
2010-07-20 13:41:15BreamoreBoysetnosy: + BreamoreBoy

messages: + msg110895
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6, Python 3.0
2009-03-30 19:04:21ajaksu2setstage: test needed
type: resource usage
versions: + Python 2.6, Python 3.0, - Python 2.5
2007-01-15 10:26:05kylotancreate