77
88"""
99
10- # Injected modules are '_warnings', 'imp', 'sys', 'marshal', 'errno', and '_os'
11- # (a.k.a. 'posix', 'nt' or 'os2').
10+ # Injected modules are '_warnings', 'imp', 'sys', 'marshal', 'errno', '_io',
11+ # and '_os' (a.k.a. 'posix', 'nt' or 'os2').
1212# Injected attribute is path_sep.
1313#
1414# When editing this code be aware that code executed at import time CANNOT
@@ -473,7 +473,7 @@ def get_source(self, fullname):
473473 if source_path is None :
474474 return None
475475 import tokenize
476- with closing (_io .FileIO (source_path , 'r' )) as file :
476+ with closing (_io .FileIO (source_path , 'r' )) as file : # Assuming bytes.
477477 encoding , lines = tokenize .detect_encoding (file .readline )
478478 # XXX Will fail when passed to compile() if the encoding is
479479 # anything other than UTF-8.
@@ -482,7 +482,7 @@ def get_source(self, fullname):
482482
483483 def get_data (self , path ):
484484 """Return the data from path as raw bytes."""
485- return _fileio . _FileIO (path , 'r' ).read ()
485+ return _io . FileIO (path , 'r' ).read () # Assuming bytes.
486486
487487 @check_name
488488 def is_package (self , fullname ):
@@ -527,7 +527,7 @@ def write_bytecode(self, name, data):
527527 bytecode_path = self .bytecode_path (name )
528528 if not bytecode_path :
529529 bytecode_path = self ._base_path + suffix_list (imp .PY_COMPILED )[0 ]
530- file = _io .FileIO (bytecode_path , 'w' )
530+ file = _io .FileIO (bytecode_path , 'w' ) # Assuming bytes.
531531 try :
532532 with closing (file ) as bytecode_file :
533533 bytecode_file .write (data )
0 commit comments