Issue #15627: This is simply an update to the name of a new method recently added

to importlib.abc.SourceLoader.
This commit is contained in:
Eric Snow 2012-12-04 23:43:43 -08:00
parent fe907e1870
commit a6cfb28bd2
5 changed files with 14 additions and 14 deletions

View file

@ -409,7 +409,7 @@ ABC hierarchy::
When writing to the path fails because the path is read-only When writing to the path fails because the path is read-only
(:attr:`errno.EACCES`), do not propagate the exception. (: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. Create a code object from Python source.

View file

@ -931,7 +931,7 @@ class SourceLoader(_LoaderBasics):
raise ImportError("Failed to decode source file", raise ImportError("Failed to decode source file",
name=fullname) from exc name=fullname) from exc
def compile_source(self, data, path): def source_to_code(self, data, path):
"""Return the code object compiled from source. """Return the code object compiled from source.
The 'data' argument can be any object type that compile() supports. The 'data' argument can be any object type that compile() supports.
@ -984,7 +984,7 @@ class SourceLoader(_LoaderBasics):
raise ImportError(msg.format(bytecode_path), raise ImportError(msg.format(bytecode_path),
name=fullname, path=bytecode_path) name=fullname, path=bytecode_path)
source_bytes = self.get_data(source_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) _verbose_message('code object from {}', source_path)
if (not sys.dont_write_bytecode and bytecode_path is not None and if (not sys.dont_write_bytecode and bytecode_path is not None and
source_mtime is not None): source_mtime is not None):

View file

@ -148,9 +148,9 @@ class SourceOnlyLoaderTests(SourceLoaderTestHarness):
code_object = self.loader.get_code(self.name) code_object = self.loader.get_code(self.name)
self.verify_code(code_object) self.verify_code(code_object)
def test_compile_source(self): def test_source_to_code(self):
# Verify the compiled code object. # 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) self.verify_code(code)
def test_load_module(self): def test_load_module(self):

View file

@ -190,7 +190,7 @@ Library
- Issue #16522: added FAIL_FAST flag to doctest. - 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 - Issue #16408: Fix file descriptors not being closed in error conditions
in the zipfile module. Patch by Serhiy Storchaka. in the zipfile module. Patch by Serhiy Storchaka.

View file

@ -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, 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, 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, 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, 111,116,115,116,114,97,112,62,117,14,0,0,0,115,111,117,
112,105,108,101,95,115,111,117,114,99,101,166,3,0,0,115, 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, 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, 114,99,101,76,111,97,100,101,114,46,115,111,117,114,99,101,
101,95,115,111,117,114,99,101,99,2,0,0,0,0,0,0, 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,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,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, 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, 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, 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, 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, 6,0,0,0,102,111,114,109,97,116,117,14,0,0,0,115,
111,109,112,105,108,101,95,115,111,117,114,99,101,117,3,0, 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, 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, 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, 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, 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, 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, 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, 103,101,116,95,115,111,117,114,99,101,117,14,0,0,0,115,
111,109,112,105,108,101,95,115,111,117,114,99,101,117,8,0, 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, 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, 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, 10,0,0,0,95,95,108,111,99,97,108,115,95,95,40,0,