Skip to content

Commit bf9fdad

Browse files
committed
Add comments
1 parent 258fca7 commit bf9fdad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mypy/stubtest.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,13 @@ def get_importable_stdlib_modules() -> set[str]:
16871687
for finder, module_group in modules_by_finder.items():
16881688
if (
16891689
"site-packages" not in Path(finder.path).parents
1690-
and {"json", "_json", "_queue"} & module_group
1690+
# if "_queue" is present, it's most likely the module finder
1691+
# for stdlib extension modules;
1692+
# if "queue" is present, it's most likely the module finder
1693+
# for pure-Python stdlib modules.
1694+
# In either case, we'll want to add all the modules that the finder has to offer us.
1695+
# This is a bit hacky, but seems to work well in a cross-platform way.
1696+
and {"_queue", "queue"} & module_group
16911697
):
16921698
all_stdlib_modules.update(module_group)
16931699

@@ -1736,6 +1742,8 @@ def get_importable_stdlib_modules() -> set[str]:
17361742
except KeyboardInterrupt:
17371743
raise
17381744
# importing multiprocessing.popen_forkserver on Windows raises AttributeError...
1745+
# some submodules also appear to raise SystemExit as well on some Python versions
1746+
# (not sure exactly which)
17391747
except BaseException:
17401748
continue
17411749
else:

0 commit comments

Comments
 (0)