@@ -823,16 +823,6 @@ def __eq__(self, other):
823823
824824 @property
825825 def cached (self ):
826- if self ._cached is None :
827- if self .origin is not None and self ._set_fileattr :
828- filename = self .origin
829- if filename .endswith (tuple (SOURCE_SUFFIXES )):
830- try :
831- self ._cached = cache_from_source (filename )
832- except NotImplementedError :
833- pass
834- elif filename .endswith (tuple (BYTECODE_SUFFIXES )):
835- self ._cached = filename
836826 return self ._cached
837827
838828 @cached .setter
@@ -1540,46 +1530,9 @@ def get_code(self, fullname):
15401530 """
15411531 source_path = self .get_filename (fullname )
15421532 source_mtime = None
1543- try :
1544- bytecode_path = cache_from_source (source_path )
1545- except NotImplementedError :
1546- bytecode_path = None
1547- else :
1548- try :
1549- st = self .path_stats (source_path )
1550- except IOError :
1551- pass
1552- else :
1553- source_mtime = int (st ['mtime' ])
1554- try :
1555- data = self .get_data (bytecode_path )
1556- except OSError :
1557- pass
1558- else :
1559- try :
1560- bytes_data = _validate_bytecode_header (data ,
1561- source_stats = st , name = fullname ,
1562- path = bytecode_path )
1563- except (ImportError , EOFError ):
1564- pass
1565- else :
1566- _verbose_message ('{} matches {}' , bytecode_path ,
1567- source_path )
1568- return _compile_bytecode (bytes_data , name = fullname ,
1569- bytecode_path = bytecode_path ,
1570- source_path = source_path )
15711533 source_bytes = self .get_data (source_path )
15721534 code_object = self .source_to_code (source_bytes , source_path )
15731535 _verbose_message ('code object from {}' , source_path )
1574- if (not sys .dont_write_bytecode and bytecode_path is not None and
1575- source_mtime is not None ):
1576- data = _code_to_bytecode (code_object , source_mtime ,
1577- len (source_bytes ))
1578- try :
1579- self ._cache_bytecode (source_path , bytecode_path , data )
1580- _verbose_message ('wrote {!r}' , bytecode_path )
1581- except NotImplementedError :
1582- pass
15831536 return code_object
15841537
15851538
@@ -2313,10 +2266,8 @@ def _get_supported_file_loaders():
23132266
23142267 Each item is a tuple (loader, suffixes).
23152268 """
2316- extensions = ExtensionFileLoader , _imp .extension_suffixes ()
23172269 source = SourceFileLoader , SOURCE_SUFFIXES
2318- bytecode = SourcelessFileLoader , BYTECODE_SUFFIXES
2319- return [extensions , source , bytecode ]
2270+ return [source ]
23202271
23212272
23222273def __import__ (name , globals = None , locals = None , fromlist = (), level = 0 ):
@@ -2435,18 +2386,9 @@ def _setup(sys_module, _imp_module):
24352386 weakref_module = _builtin_from_name ('_weakref' )
24362387 setattr (self_module , '_weakref' , weakref_module )
24372388
2438- # Directly load the winreg module (needed during bootstrap).
2439- if builtin_os == 'nt' :
2440- winreg_module = _builtin_from_name ('winreg' )
2441- setattr (self_module , '_winreg' , winreg_module )
2442-
24432389 # Constants
24442390 setattr (self_module , '_relax_case' , _make_relax_case ())
24452391 EXTENSION_SUFFIXES .extend (_imp .extension_suffixes ())
2446- if builtin_os == 'nt' :
2447- SOURCE_SUFFIXES .append ('.pyw' )
2448- if '_d.pyd' in EXTENSION_SUFFIXES :
2449- WindowsRegistryFinder .DEBUG_BUILD = True
24502392
24512393
24522394def _install (sys_module , _imp_module ):
@@ -2456,6 +2398,4 @@ def _install(sys_module, _imp_module):
24562398 sys .path_hooks .extend ([FileFinder .path_hook (* supported_loaders )])
24572399 sys .meta_path .append (BuiltinImporter )
24582400 sys .meta_path .append (FrozenImporter )
2459- if _os .__name__ == 'nt' :
2460- sys .meta_path .append (WindowsRegistryFinder )
24612401 sys .meta_path .append (PathFinder )
0 commit comments