Sitelet https://github.com/python/cpython/commit/a6cfb28bd2611abefe08b11512e8378ddd2b8c57
Skip to content

Commit a6cfb28

Browse files
Issue #15627: This is simply an update to the name of a new method recently added
to importlib.abc.SourceLoader.
1 parent fe907e1 commit a6cfb28

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎Doc/library/importlib.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ ABC hierarchy::
409409
When writing to the path fails because the path is read-only
410410
(:attr:`errno.EACCES`), do not propagate the exception.
411411

412-
.. method:: compile_source(data, path)
412+
.. method:: source_to_code(data, path)
413413

414414
Create a code object from Python source.
415415

‎Lib/importlib/_bootstrap.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ def get_source(self, fullname):
931931
raise ImportError("Failed to decode source file",
932932
name=fullname) from exc
933933

934-
def compile_source(self, data, path):
934+
def source_to_code(self, data, path):
935935
"""Return the code object compiled from source.
936936
937937
The 'data' argument can be any object type that compile() supports.
@@ -984,7 +984,7 @@ def get_code(self, fullname):
984984
raise ImportError(msg.format(bytecode_path),
985985
name=fullname, path=bytecode_path)
986986
source_bytes = self.get_data(source_path)
987-
code_object = self.compile_source(source_bytes, source_path)
987+
code_object = self.source_to_code(source_bytes, source_path)
988988
_verbose_message('code object from {}', source_path)
989989
if (not sys.dont_write_bytecode and bytecode_path is not None and
990990
source_mtime is not None):

‎Lib/test/test_importlib/source/test_abc_loader.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ def test_get_code(self):
148148
code_object = self.loader.get_code(self.name)
149149
self.verify_code(code_object)
150150

151-
def test_compile_source(self):
151+
def test_source_to_code(self):
152152
# Verify the compiled code object.
153-
code = self.loader.compile_source(self.loader.source, self.path)
153+
code = self.loader.source_to_code(self.loader.source, self.path)
154154
self.verify_code(code)
155155

156156
def test_load_module(self):

‎Misc/NEWS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Library
190190

191191
- Issue #16522: added FAIL_FAST flag to doctest.
192192

193-
- Issue #15627: Add the importlib.abc.SourceLoader.compile_source() method.
193+
- Issue #15627: Add the importlib.abc.SourceLoader.source_to_code() method.
194194

195195
- Issue #16408: Fix file descriptors not being closed in error conditions
196196
in the zipfile module. Patch by Serhiy Storchaka.

‎Python/importlib.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,11 +2200,11 @@ unsigned char _Py_M__importlib[] = {
22002200
97,116,97,117,4,0,0,0,112,97,116,104,40,0,0,0,
22012201
0,40,0,0,0,0,117,29,0,0,0,60,102,114,111,122,
22022202
101,110,32,105,109,112,111,114,116,108,105,98,46,95,98,111,
2203-
111,116,115,116,114,97,112,62,117,14,0,0,0,99,111,109,
2204-
112,105,108,101,95,115,111,117,114,99,101,166,3,0,0,115,
2203+
111,116,115,116,114,97,112,62,117,14,0,0,0,115,111,117,
2204+
114,99,101,95,116,111,95,99,111,100,101,166,3,0,0,115,
22052205
4,0,0,0,0,5,18,1,117,27,0,0,0,83,111,117,
2206-
114,99,101,76,111,97,100,101,114,46,99,111,109,112,105,108,
2207-
101,95,115,111,117,114,99,101,99,2,0,0,0,0,0,0,
2206+
114,99,101,76,111,97,100,101,114,46,115,111,117,114,99,101,
2207+
95,116,111,95,99,111,100,101,99,2,0,0,0,0,0,0,
22082208
0,12,0,0,0,45,0,0,0,67,0,0,0,115,43,2,
22092209
0,0,124,0,0,106,0,0,124,1,0,131,1,0,125,2,
22102210
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[] = {
22782278
99,101,117,10,0,0,0,95,99,111,100,101,95,116,121,112,
22792279
101,117,4,0,0,0,95,105,109,112,117,16,0,0,0,95,
22802280
102,105,120,95,99,111,95,102,105,108,101,110,97,109,101,117,
2281-
6,0,0,0,102,111,114,109,97,116,117,14,0,0,0,99,
2282-
111,109,112,105,108,101,95,115,111,117,114,99,101,117,3,0,
2281+
6,0,0,0,102,111,114,109,97,116,117,14,0,0,0,115,
2282+
111,117,114,99,101,95,116,111,95,99,111,100,101,117,3,0,
22832283
0,0,115,121,115,117,19,0,0,0,100,111,110,116,95,119,
22842284
114,105,116,101,95,98,121,116,101,99,111,100,101,117,9,0,
22852285
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[] = {
23452345
112,97,116,104,95,115,116,97,116,115,117,15,0,0,0,95,
23462346
99,97,99,104,101,95,98,121,116,101,99,111,100,101,117,8,
23472347
0,0,0,115,101,116,95,100,97,116,97,117,10,0,0,0,
2348-
103,101,116,95,115,111,117,114,99,101,117,14,0,0,0,99,
2349-
111,109,112,105,108,101,95,115,111,117,114,99,101,117,8,0,
2348+
103,101,116,95,115,111,117,114,99,101,117,14,0,0,0,115,
2349+
111,117,114,99,101,95,116,111,95,99,111,100,101,117,8,0,
23502350
0,0,103,101,116,95,99,111,100,101,117,11,0,0,0,108,
23512351
111,97,100,95,109,111,100,117,108,101,40,1,0,0,0,117,
23522352
10,0,0,0,95,95,108,111,99,97,108,115,95,95,40,0,

0 commit comments

Comments
 (0)