Mercurial > cpython-lru_cache-weakref
diff Lib/importlib/_bootstrap.py @ 76451:ea46ebba8a0f
Issue #13959: Re-implement imp.source_from_cache() in Lib/imp.py.
| author | Brett Cannon <brett@python.org> |
|---|---|
| date | Sat, 21 Apr 2012 18:52:52 -0400 |
| parents | b773a751c2e7 |
| children | 024660a2faaa |
line wrap: on
line diff
--- a/Lib/importlib/_bootstrap.py Fri Apr 20 21:44:46 2012 -0400 +++ b/Lib/importlib/_bootstrap.py Sat Apr 21 18:52:52 2012 -0400 @@ -180,6 +180,8 @@ PYCACHE = '__pycache__' +SOURCE_SUFFIXES = ['.py'] # _setup() adds .pyw as needed. + DEBUG_BYTECODE_SUFFIX = '.pyc' OPT_BYTECODE_SUFFIX = '.pyo' BYTECODE_SUFFIX = DEBUG_BYTECODE_SUFFIX if __debug__ else OPT_BYTECODE_SUFFIX @@ -199,7 +201,7 @@ suffix = DEBUG_BYTECODE_SUFFIX if debug else OPT_BYTECODE_SUFFIX head, tail = _path_split(path) base_filename, sep, _ = tail.partition('.') - filename = '{}{}{}{}'.format(base_filename, sep, _imp.get_tag(), suffix) + filename = ''.join([base_filename, sep, _imp.get_tag(), suffix]) return _path_join(head, PYCACHE, filename) @@ -1195,6 +1197,8 @@ # Constants setattr(self_module, '_relax_case', _make_relax_case()) setattr(self_module, '_MAGIC_NUMBER', _imp_module.get_magic()) + if builtin_os == 'nt': + SOURCE_SUFFIXES.append('.pyw') def _install(sys_module, _imp_module):
