New submission from hai shi <shihai1...@126.com>:
In master branch, `_PyWarnings_Init()` have been called twice. ``` (gdb) bt #0 _PyWarnings_Init () at Python/_warnings.c:1338 #1 0x0000000000525df3 in pycore_init_import_warnings (tstate=tstate@entry=0x9a19c0, sysmod=0x7ffff7f7e5f0) at Python/pylifecycle.c:680 ... Breakpoint 1, _PyWarnings_Init () at Python/_warnings.c:1338 1338 { (gdb) bt #0 _PyWarnings_Init () at Python/_warnings.c:1338 #1 0x0000000000511aac in _imp_create_builtin (module=<optimized out>, spec=0x7ffff7f2e7d0) at Python/import.c:1293 ``` but in 2.7 branch, '_PyWarnings_Init()': ``` Breakpoint 1, _PyWarnings_Init() at Python/_warnings.c:886 886 m = Py_InitModule3(MODULE_NAME, warnings_functions, warnings__doc__); Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7_6.4.x86_64 (gdb) bt #0 _PyWarnings_Init () at Python/_warnings.c:886 #1 0x00000000004fc4db in Py_InitializeEx (install_sigs=1) at Python/pythonrun.c:242 #2 0x00000000004fcb03 in Py_Initialize () at Python/pythonrun.c:370 #3 0x00000000004154fd in Py_Main (argc=1, argv=0x7fffffffe428) at Modules/main.c:505 #4 0x00000000004145f0 in main (argc=1, argv=0x7fffffffe428) at ./Modules/python.c:23 ``` Why? because pylifecycle.c and _imp extension module will call `_PyWarnings_Init()`. isn't it? ---------- components: Extension Modules messages: 362980 nosy: brett.cannon, shihai1991 priority: normal severity: normal status: open title: warning extension module inited twice in python3.9 type: enhancement versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39796> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com