8000 GH-102700: allow built-in modules to be submodules (GH-103162) · python/cpython@5d08c3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d08c3f

Browse files
authored
GH-102700: allow built-in modules to be submodules (GH-103162)
1 parent dca7d17 commit 5d08c3f

File tree

3 files changed

+1
-19
lines changed

3 files changed

+1
-19
lines changed

Lib/importlib/_bootstrap.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,6 @@ class BuiltinImporter:
887887

888888
@classmethod
889889
def find_spec(cls, fullname, path=None, target=None):
890-
if path is not None:
891-
return None
892890
if _imp.is_builtin(fullname):
893891
return spec_from_loader(fullname, cls, origin=cls._ORIGIN)
894892
else:

Lib/test/test_importlib/builtin/test_finder.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ def test_failure(self):
3737
spec = self.machinery.BuiltinImporter.find_spec(name)
3838
self.assertIsNone(spec)
3939

40-
def test_ignore_path(self):
41-
# The value for 'path' should always trigger a failed import.
42-
with util.uncache(util.BUILTINS.good_name):
43-
spec = self.machinery.BuiltinImporter.find_spec(util.BUILTINS.good_name,
44-
['pkg'])
45-
self.assertIsNone(spec)
46-
4740

4841
(Frozen_FindSpecTests,
4942
Source_FindSpecTests
@@ -77,16 +70,6 @@ def test_failure(self):
7770
loader = self.machinery.BuiltinImporter.find_module('importlib')
7871
self.assertIsNone(loader)
7972

80-
def test_ignore_path(self):
81-
# The value for 'path' should always trigger a failed import.
82-
with util.uncache(util.BUILTINS.good_name):
83-
with warnings.catch_warnings():
84-
warnings.simplefilter("ignore", DeprecationWarning)
85-
loader = self.machinery.BuiltinImporter.find_module(
86-
util.BUILTINS.good_name,
87-
['pkg'])
88-
self.assertIsNone(loader)
89-
9073

9174
(Frozen_FinderTests,
9275
Source_FinderTests
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow built-in modules to be submodules. This allows submodules to be statically linked into a CPython binary.

0 commit comments

Comments
 (0)
0