bpo-1635741: Port _locale extension module to multiphase initialization (PEP 489) by shihai1991 · Pull Request #18358 · python/cpython (original) (raw)
I remove assert operation in get_locale_state()
, becasue this assert operation always failed when I add traverse slot.
I am not check the code detail. From this result, removing the assert()
from get_locale_state()
is ok, because we have chance get A NULL state.
some error info like:
$ ./python -E -S -m sysconfig --generate-posix-vars
python: ./Modules/_localemodule.c:52: get_locale_state: Assertion `state != ((void *)0)' failed.
[1] 17894 abort ./python -E -S -m sysconfig --generate-posix-vars
and the trace back:
#0 0x00007ffff6ce2207 in raise () from /lib64/libc.so.6
#1 0x00007ffff6ce38f8 in abort () from /lib64/libc.so.6
#2 0x00007ffff6cdb026 in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007ffff6cdb0d2 in __assert_fail () from /lib64/libc.so.6
#4 0x00000000005986f3 in get_locale_state (m=<optimized out>) at ./Modules/_localemodule.c:52
#5 locale_traverse (m=<optimized out>, visit=0x462d26 <bad_traverse_test>, arg=0x0) at ./Modules/_localemodule.c:780
#6 0x000000000046384c in PyModule_FromDefAndSpec2TraceRefs (def=def@entry=0x96e680 <_localemodule>, spec=spec@entry=0x7ffff00567d0, module_api_version=module_api_version@entry=1013)
at Objects/moduleobject.c:370
#7 0x0000000000512153 in _imp_create_builtin (module=<optimized out>, spec=0x7ffff00567d0) at Python/import.c:1300