[docs] [issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

STINNER Victor report at bugs.python.org
Thu May 24 16:24:02 EDT 2018


STINNER Victor <vstinner at redhat.com> added the comment:

MultiPhaseExtensionModuleTests.test_bad_traverse() of Lib/test/test_importlib/extension/test_loader.py 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)
---

And then check that the Python "failed": that the exit code is non-zero...

That's a weak test: if the script fails before calling spec.loader.create_module(), the test also pass. If the function raises an exception but don't crash, the test pass as well.

More generally, I'm not sure about the idea of making sure that doing bad stuff with traverse does crash. What is the purpose of the test?

In the meanwhile, I fixed bpo-33629 by adding test.support.SuppressCrashReport().

I'm not asking to do something. Maybe it's fine to keep the current test.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32374>
_______________________________________


More information about the docs mailing list