[issue39796] warning extension module inited twice in python3.9

2020-03-02 Thread hai shi
hai shi added the comment: copy that, thanks for your explanation, victor. -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue39796] warning extension module inited twice in python3.9

2020-03-02 Thread STINNER Victor
STINNER Victor added the comment: > if we don't load _warnings module as soon as possible, what possible risks > will be raise? There are different risks: * Worst case: using the _warnings module state before it's initialized may lead to crash. * Best case: some warnings are not emitted. A

[issue39796] warning extension module inited twice in python3.9

2020-03-02 Thread STINNER Victor
STINNER Victor added the comment: New changeset 66b7973c1b2e6aa6a2462c6b13971a08cd665af2 by Victor Stinner in branch 'master': bpo-39796: Fix _warnings module initialization (GH-18739) https://github.com/python/cpython/commit/66b7973c1b2e6aa6a2462c6b13971a08cd665af2 --

[issue39796] warning extension module inited twice in python3.9

2020-03-02 Thread hai shi
hai shi added the comment: Wow, Thanks, victor, much useful infos. >In Python 3, _PyWarnings_Init() calls PyModule_Create() which creates a module >but doesn't add it to sys.modules. this operation will be executed in _bootstrap_external. > We want the _warnings module to be ready as early

[issue39796] warning extension module inited twice in python3.9

2020-03-02 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18094 pull_request: https://github.com/python/cpython/pull/18739 ___ Python tracker ___ __

[issue39796] warning extension module inited twice in python3.9

2020-03-02 Thread STINNER Victor
STINNER Victor added the comment: _PyWarnings_Init() initializes tstate->interp->warnings which is the module state of the warnings module: WarningsState *st = _Warnings_GetState(); if (st == NULL) { goto error; } if (_Warnings_InitState(st) < 0) { goto error;

[issue39796] warning extension module inited twice in python3.9

2020-02-29 Thread hai shi
Change by hai shi : -- keywords: +patch pull_requests: +18062 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18700 ___ Python tracker ___

[issue39796] warning extension module inited twice in python3.9

2020-02-29 Thread hai shi
New submission from hai shi : In master branch, `_PyWarnings_Init()` have been called twice. ``` (gdb) bt #0 _PyWarnings_Init () at Python/_warnings.c:1338 #1 0x00525df3 in pycore_init_import_warnings (tstate=tstate@entry=0x9a19c0, sysmod=0x77f7e5f0) at Python/pylifecycle.c:680 .