File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1687,7 +1687,13 @@ def get_importable_stdlib_modules() -> set[str]:
1687
1687
for finder , module_group in modules_by_finder .items ():
1688
1688
if (
1689
1689
"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
1691
1697
):
1692
1698
all_stdlib_modules .update (module_group )
1693
1699
@@ -1736,6 +1742,8 @@ def get_importable_stdlib_modules() -> set[str]:
1736
1742
except KeyboardInterrupt :
1737
1743
raise
1738
1744
# 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)
1739
1747
except BaseException :
1740
1748
continue
1741
1749
else :
You can’t perform that action at this time.
0 commit comments