Skip to content

Commit a06d51a

Browse files
revert change in traceback and add discover
1 parent 03a9290 commit a06d51a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,14 @@ def is_package(cls, fullname):
938938
"""Return False as built-in modules are never packages."""
939939
return False
940940

941+
@classmethod
942+
def discover(cls, spec=None):
943+
if spec is not None: # assume that built-in modules have no submodule
944+
return
945+
for i in sys.builtin_module_names:
946+
if i_spec := cls.find_spec(i):
947+
yield i_spec
948+
941949

942950
class FrozenImporter:
943951

0 commit comments

Comments
 (0)