summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/importlib.rst2
-rw-r--r--Lib/importlib/_bootstrap.py4
-rw-r--r--Lib/test/test_importlib/source/test_abc_loader.py4
-rw-r--r--Misc/NEWS2
-rw-r--r--Python/importlib.h16
5 files changed, 14 insertions, 14 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 6c9c6b3..ee9045b 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -409,7 +409,7 @@ ABC hierarchy::
When writing to the path fails because the path is read-only
(:attr:`errno.EACCES`), do not propagate the exception.
- .. method:: compile_source(data, path)
+ .. method:: source_to_code(data, path)
Create a code object from Python source.
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 2e0bd6a..0c6252e 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -931,7 +931,7 @@ class SourceLoader(_LoaderBasics):
raise ImportError("Failed to decode source file",
name=fullname) from exc
- def compile_source(self, data, path):
+ def source_to_code(self, data, path):
"""Return the code object compiled from source.
The 'data' argument can be any object type that compile() supports.
@@ -984,7 +984,7 @@ class SourceLoader(_LoaderBasics):
raise ImportError(msg.format(bytecode_path),
name=fullname, path=bytecode_path)
source_bytes = self.get_data(source_path)
- code_object = self.compile_source(source_bytes, source_path)
+ code_object = self.source_to_code(source_bytes, source_path)
_verbose_message('code object from {}', source_path)
if (not sys.dont_write_bytecode and bytecode_path is not None and
source_mtime is not None):
diff --git a/Lib/test/test_importlib/source/test_abc_loader.py b/Lib/test/test_importlib/source/test_abc_loader.py
index 44bec32..cce7b07 100644
--- a/Lib/test/test_importlib/source/test_abc_loader.py
+++ b/Lib/test/test_importlib/source/test_abc_loader.py
@@ -148,9 +148,9 @@ class SourceOnlyLoaderTests(SourceLoaderTestHarness):
code_object = self.loader.get_code(self.name)
self.verify_code(code_object)
- def test_compile_source(self):
+ def test_source_to_code(self):
# Verify the compiled code object.
- code = self.loader.compile_source(self.loader.source, self.path)
+ code = self.loader.source_to_code(self.loader.source, self.path)
self.verify_code(code)
def test_load_module(self):
diff --git a/Misc/NEWS b/Misc/NEWS
index 77c726b..6f73084 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -190,7 +190,7 @@ Library
- Issue #16522: added FAIL_FAST flag to doctest.
-- Issue #15627: Add the importlib.abc.SourceLoader.compile_source() method.
+- Issue #15627: Add the importlib.abc.SourceLoader.source_to_code() method.
- Issue #16408: Fix file descriptors not being closed in error conditions
in the zipfile module. Patch by Serhiy Storchaka.
diff --git a/Python/importlib.h b/Python/importlib.h
index 3c0015b..ea71863 100644
--- a/Python/importlib.h
+++ b/Python/importlib.h
@@ -2200,11 +2200,11 @@ unsigned char _Py_M__importlib[] = {
97,116,97,117,4,0,0,0,112,97,116,104,40,0,0,0,
0,40,0,0,0,0,117,29,0,0,0,60,102,114,111,122,
101,110,32,105,109,112,111,114,116,108,105,98,46,95,98,111,
- 111,116,115,116,114,97,112,62,117,14,0,0,0,99,111,109,
- 112,105,108,101,95,115,111,117,114,99,101,166,3,0,0,115,
+ 111,116,115,116,114,97,112,62,117,14,0,0,0,115,111,117,
+ 114,99,101,95,116,111,95,99,111,100,101,166,3,0,0,115,
4,0,0,0,0,5,18,1,117,27,0,0,0,83,111,117,
- 114,99,101,76,111,97,100,101,114,46,99,111,109,112,105,108,
- 101,95,115,111,117,114,99,101,99,2,0,0,0,0,0,0,
+ 114,99,101,76,111,97,100,101,114,46,115,111,117,114,99,101,
+ 95,116,111,95,99,111,100,101,99,2,0,0,0,0,0,0,
0,12,0,0,0,45,0,0,0,67,0,0,0,115,43,2,
0,0,124,0,0,106,0,0,124,1,0,131,1,0,125,2,
0,100,8,0,125,3,0,121,16,0,116,2,0,124,2,0,
@@ -2278,8 +2278,8 @@ unsigned char _Py_M__importlib[] = {
99,101,117,10,0,0,0,95,99,111,100,101,95,116,121,112,
101,117,4,0,0,0,95,105,109,112,117,16,0,0,0,95,
102,105,120,95,99,111,95,102,105,108,101,110,97,109,101,117,
- 6,0,0,0,102,111,114,109,97,116,117,14,0,0,0,99,
- 111,109,112,105,108,101,95,115,111,117,114,99,101,117,3,0,
+ 6,0,0,0,102,111,114,109,97,116,117,14,0,0,0,115,
+ 111,117,114,99,101,95,116,111,95,99,111,100,101,117,3,0,
0,0,115,121,115,117,19,0,0,0,100,111,110,116,95,119,
114,105,116,101,95,98,121,116,101,99,111,100,101,117,9,0,
0,0,98,121,116,101,97,114,114,97,121,117,12,0,0,0,
@@ -2345,8 +2345,8 @@ unsigned char _Py_M__importlib[] = {
112,97,116,104,95,115,116,97,116,115,117,15,0,0,0,95,
99,97,99,104,101,95,98,121,116,101,99,111,100,101,117,8,
0,0,0,115,101,116,95,100,97,116,97,117,10,0,0,0,
- 103,101,116,95,115,111,117,114,99,101,117,14,0,0,0,99,
- 111,109,112,105,108,101,95,115,111,117,114,99,101,117,8,0,
+ 103,101,116,95,115,111,117,114,99,101,117,14,0,0,0,115,
+ 111,117,114,99,101,95,116,111,95,99,111,100,101,117,8,0,
0,0,103,101,116,95,99,111,100,101,117,11,0,0,0,108,
111,97,100,95,109,111,100,117,108,101,40,1,0,0,0,117,
10,0,0,0,95,95,108,111,99,97,108,115,95,95,40,0,