New submission from STINNER Victor <vstin...@python.org>:
Using the C program below, I see that _Py_RefTotal is decreasing at each iteration: --- #include <Python.h> int main(int argc, char *argv[]) { for (int i=1; i <= 100; i++) { Py_SetProgramName(L"./_testembed"); Py_Initialize(); Py_Finalize(); printf("Loop #%d: %zd refs\n", i, _Py_RefTotal); } } --- Example of output: --- ... Loop #96: 9557 refs Loop #97: 9544 refs Loop #98: 9531 refs Loop #99: 9518 refs Loop #100: 9505 refs --- It seems to be a regression caused by this change: commit 1cbaa505d007e11c4a1f0d2073d72b6c02c7147c Author: Guido van Rossum <gu...@python.org> Date: Wed Nov 10 18:01:53 2021 -0800 bpo-45696: Deep-freeze selected modules (GH-29118) This gains 10% or more in startup time for `python -c pass` on UNIX-ish systems. The Makefile.pre.in generating code builds on Eric's work for bpo-45020, but the .c file generator is new. Windows version TBD. Before the change, _Py_RefTotal was stable: --- ... Loop #97: 10805 refs Loop #98: 10805 refs Loop #99: 10805 refs Loop #100: 10805 refs --- I found this issue while working on bpo-46417 which is related to bpo-1635741. ---------- components: Interpreter Core messages: 411075 nosy: vstinner priority: normal severity: normal status: open title: Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal) versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46449> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com