Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite807b79

Browse files
brettcannonmiss-islington
authored andcommitted
pythonGH-102700: allow built-in modules to be submodules (pythonGH-103162)
(cherry picked from commit5d08c3f)Co-authored-by: Brett Cannon <brett@python.org>
1 parent58e330a commite807b79

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
@@ -747,8 +747,6 @@ def module_repr(module):
747747

748748
@classmethod
749749
deffind_spec(cls,fullname,path=None,target=None):
750-
ifpathisnotNone:
751-
returnNone
752750
if_imp.is_builtin(fullname):
753751
returnspec_from_loader(fullname,cls,origin=cls._ORIGIN)
754752
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-
deftest_ignore_path(self):
41-
# The value for 'path' should always trigger a failed import.
42-
withutil.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-
deftest_ignore_path(self):
81-
# The value for 'path' should always trigger a failed import.
82-
withutil.uncache(util.BUILTINS.good_name):
83-
withwarnings.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)

[8]ページ先頭

©2009-2025 Movatter.jp