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.

Author vstinner
Recipients koobs, vstinner
Date 2018-05-24.02:08:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527127715.6.0.682650639539.issue33629@psf.upfronthosting.co.za>
In-reply-to
Content
The problem comes from MultiPhaseExtensionModuleTests.test_bad_traverse() of Lib/test/test_importlib/extension/test_loader.py.

This test runs the following code:
---
import importlib.util as util
spec = util.find_spec('_testmultiphase')
spec.name = '_testmultiphase_with_bad_traverse'
m = spec.loader.create_module(spec)
---

I confirm that this script does crash and may generate a core dump:

vstinner@apu$ ./python x.py
Segmentation fault (core dumped)

Python traceback of the crash:

(gdb) py-bt
Traceback (most recent call first):
  <built-in method create_dynamic of module object at remote 0x7ffff7f37458>
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "x.py", line 4, in <module>
    m = spec.loader.create_module(spec)

C traceback:

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeffb69f3 in bad_traverse (self=<module at remote 0x7ffff7e59658>, visit=0x481b4d <bad_traverse_test>, arg=0x0)
    at /home/vstinner/prog/python/master/Modules/_testmultiphase.c:628
628	    Py_VISIT(m_state->integer);
(gdb) where
#0  0x00007fffeffb69f3 in bad_traverse (self=<module at remote 0x7ffff7e59658>, visit=0x481b4d <bad_traverse_test>, arg=0x0)
    at /home/vstinner/prog/python/master/Modules/_testmultiphase.c:628
#1  0x0000000000482866 in PyModule_FromDefAndSpec2TraceRefs (def=0x7ffff01b8ce0 <def_with_bad_traverse>, 
    spec=<ModuleSpec(name='_testmultiphase_with_bad_traverse', loader=<ExtensionFileLoader(name='_testmultiphase', path='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so') at remote 0x7ffff04632c8>, origin='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7ffff0463330>, module_api_version=1013) at Objects/moduleobject.c:366
#2  0x000000000057ed89 in _PyImport_LoadDynamicModuleWithSpec (
    spec=<ModuleSpec(name='_testmultiphase_with_bad_traverse', loader=<ExtensionFileLoader(name='_testmultiphase', path='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so') at remote 0x7ffff04632c8>, origin='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7ffff0463330>, fp=0x0) at ./Python/importdl.c:193
#3  0x000000000057df53 in _imp_create_dynamic_impl (module=<module at remote 0x7ffff7f37458>, 
    spec=<ModuleSpec(name='_testmultiphase_with_bad_traverse', loader=<ExtensionFileLoader(name='_testmultiphase', path='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so') at remote 0x7ffff04632c8>, origin='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7ffff0463330>, file=0x0) at Python/import.c:2174
#4  0x000000000057789f in _imp_create_dynamic (module=<module at remote 0x7ffff7f37458>, args=0x7ffff7f1f630, nargs=1) at Python/clinic/import.c.h:289
(...)
History
Date User Action Args
2018-05-24 02:08:35vstinnersetrecipients: + vstinner, koobs
2018-05-24 02:08:35vstinnersetmessageid: <1527127715.6.0.682650639539.issue33629@psf.upfronthosting.co.za>
2018-05-24 02:08:35vstinnerlinkissue33629 messages
2018-05-24 02:08:34vstinnercreate