New GitHub issue #115341 from serhiy-storchaka:<br>
<hr>
<pre>
# Bug report
For example:
```
$ ./pythonx -OO -m test -vuall test_code
...
0:00:00 load avg: 1.64 [1/1] test_code
Failed to call load_tests:
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/unittest/loader.py", line 113, in loadTestsFromModule
return load_tests(self, tests, pattern)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/serhiy/py/cpython/Lib/test/test_code.py", line 880, in load_tests
tests.addTest(doctest.DocTestSuite())
~~~~~~~~~~~~~~~~~~~~^^
File "/home/serhiy/py/cpython/Lib/doctest.py", line 2452, in DocTestSuite
suite.addTest(SkipDocTestCase(module))
~~~~~~~~~~~~~~~^^^^^^^^
File "/home/serhiy/py/cpython/Lib/doctest.py", line 2386, in __init__
DocTestCase.__init__(self, None)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/home/serhiy/py/cpython/Lib/doctest.py", line 2228, in __init__
self._dt_globs = test.globs.copy()
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'globs'
test test_code crashed -- Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/test/libregrtest/single.py", line 178, in _runtest_env_changed_exc
_load_run_test(result, runtests)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/serhiy/py/cpython/Lib/test/libregrtest/single.py", line 135, in _load_run_test
regrtest_runner(result, test_func, runtests)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/serhiy/py/cpython/Lib/test/libregrtest/single.py", line 88, in regrtest_runner
test_result = test_func()
~~~~~~~~~^^
File "/home/serhiy/py/cpython/Lib/test/libregrtest/single.py", line 132, in test_func
return run_unittest(test_mod)
~~~~~~~~~~~~^^^^^^^^^^
File "/home/serhiy/py/cpython/Lib/test/libregrtest/single.py", line 35, in run_unittest
raise Exception("errors while loading tests")
Exception: errors while loading tests
test_code failed (uncaught exception)
== Tests result: FAILURE ==
...
```
It seems that the regression was caused by 7ba7eae50803b11766421cb8aae1780058a57e2b (GH-31932, bpo-2604).
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/115341">View on GitHub</a>
<p>Labels: type-bug, tests, 3.11, 3.12, 3.13</p>
<p>Assignee: </p>