Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Aug 25, 2023
1 parent 258fca7 commit bf9fdad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,13 @@ def get_importable_stdlib_modules() -> set[str]:
for finder, module_group in modules_by_finder.items():
if (
"site-packages" not in Path(finder.path).parents
and {"json", "_json", "_queue"} & module_group
# if "_queue" is present, it's most likely the module finder
# for stdlib extension modules;
# if "queue" is present, it's most likely the module finder
# for pure-Python stdlib modules.
# In either case, we'll want to add all the modules that the finder has to offer us.
# This is a bit hacky, but seems to work well in a cross-platform way.
and {"_queue", "queue"} & module_group
):
all_stdlib_modules.update(module_group)

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

0 comments on commit bf9fdad

Please sign in to comment.