8000 GH-102700: allow built-in modules to be submodules by brettcannon · Pull Request #103162 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-102700: allow built-in modules to be submodules #103162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/importlib/_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,6 @@ class BuiltinImporter:

@classmethod
def find_spec(cls, fullname, path=None, target=None):
if path is not None:
return None
if _imp.is_builtin(fullname):
return spec_from_loader(fullname, cls, origin=cls._ORIGIN)
else:
Expand Down
17 changes: 0 additions & 17 deletions Lib/test/test_importlib/builtin/test_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ def test_failure(self):
spec = self.machinery.BuiltinImporter.find_spec(name)
self.assertIsNone(spec)

def test_ignore_path(self):
# The value for 'path' should always trigger a failed import.
with util.uncache(util.BUILTINS.good_name):
spec = self.machinery.BuiltinImporter.find_spec(util.BUILTINS.good_name,
['pkg'])
self.assertIsNone(spec)


(Frozen_FindSpecTests,
Source_FindSpecTests
Expand Down Expand Up @@ -77,16 +70,6 @@ def test_failure(self):
loader = self.machinery.BuiltinImporter.find_module('importlib')
self.assertIsNone(loader)

def test_ignore_path(self):
# The value for 'path' should always trigger a failed import.
with util.uncache(util.BUILTINS.good_name):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.BuiltinImporter.find_module(
util.BUILTINS.good_name,
['pkg'])
self.assertIsNone(loader)


(Frozen_FinderTests,
Source_FinderTests
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow built-in modules to be submodules. This allows submodules to be statically linked into a CPython binary.
0