Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2003)

Side by Side Diff: Lib/importlib/_bootstrap_external.py

Issue 27095: Simplify MAKE_FUNCTION
Patch Set: Created 3 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 """Core implementation of path-based import. 1 """Core implementation of path-based import.
2 2
3 This module is NOT meant to be directly imported! It has been designed such 3 This module is NOT meant to be directly imported! It has been designed such
4 that it can be bootstrapped into Python as the implementation of import. As 4 that it can be bootstrapped into Python as the implementation of import. As
5 such it requires the injection of specific modules and attributes in order to 5 such it requires the injection of specific modules and attributes in order to
6 work. One should use importlib as the public-facing version of this module. 6 work. One should use importlib as the public-facing version of this module.
7 7
8 """ 8 """
9 # 9 #
10 # IMPORTANT: Whenever making changes to this module, be sure to run 10 # IMPORTANT: Whenever making changes to this module, be sure to run
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 # Python 3.4a1 3280 (remove implicit class argument) 218 # Python 3.4a1 3280 (remove implicit class argument)
219 # Python 3.4a4 3290 (changes to __qualname__ computation) 219 # Python 3.4a4 3290 (changes to __qualname__ computation)
220 # Python 3.4a4 3300 (more changes to __qualname__ computation) 220 # Python 3.4a4 3300 (more changes to __qualname__ computation)
221 # Python 3.4rc2 3310 (alter __qualname__ computation) 221 # Python 3.4rc2 3310 (alter __qualname__ computation)
222 # Python 3.5a0 3320 (matrix multiplication operator) 222 # Python 3.5a0 3320 (matrix multiplication operator)
223 # Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations) 223 # Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations)
224 # Python 3.5b2 3340 (fix dictionary display evaluation order #11205) 224 # Python 3.5b2 3340 (fix dictionary display evaluation order #11205)
225 # Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400) 225 # Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400)
226 # Python 3.6a0 3360 (add FORMAT_VALUE opcode #25483 226 # Python 3.6a0 3360 (add FORMAT_VALUE opcode #25483
227 # Python 3.6a0 3361 (lineno delta of code.co_lnotab becomes signed) 227 # Python 3.6a0 3361 (lineno delta of code.co_lnotab becomes signed)
228 # Python 3.6a0 3370 (16 bit wordcode) 228 # Python 3.6a1 3370 (16 bit wordcode)
229 # Python 3.6a1 3371 (MAKE_FUNCTION simplification)
229 # 230 #
230 # MAGIC must change whenever the bytecode emitted by the compiler may no 231 # MAGIC must change whenever the bytecode emitted by the compiler may no
231 # longer be understood by older implementations of the eval loop (usually 232 # longer be understood by older implementations of the eval loop (usually
232 # due to the addition of new opcodes). 233 # due to the addition of new opcodes).
233 # 234 #
234 # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array 235 # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
235 # in PC/launcher.c must also be updated. 236 # in PC/launcher.c must also be updated.
236 237
237 MAGIC_NUMBER = (3370).to_bytes(2, 'little') + b'\r\n' 238 MAGIC_NUMBER = (3371).to_bytes(2, 'little') + b'\r\n'
238 _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c 239 _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
239 240
240 _PYCACHE = '__pycache__' 241 _PYCACHE = '__pycache__'
241 _OPT = 'opt-' 242 _OPT = 'opt-'
242 243
243 SOURCE_SUFFIXES = ['.py'] # _setup() adds .pyw as needed. 244 SOURCE_SUFFIXES = ['.py'] # _setup() adds .pyw as needed.
244 245
245 BYTECODE_SUFFIXES = ['.pyc'] 246 BYTECODE_SUFFIXES = ['.pyc']
246 # Deprecated. 247 # Deprecated.
247 DEBUG_BYTECODE_SUFFIXES = OPTIMIZED_BYTECODE_SUFFIXES = BYTECODE_SUFFIXES 248 DEBUG_BYTECODE_SUFFIXES = OPTIMIZED_BYTECODE_SUFFIXES = BYTECODE_SUFFIXES
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 supported_loaders = _get_supported_file_loaders() 1424 supported_loaders = _get_supported_file_loaders()
1424 sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) 1425 sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])
1425 if _os.__name__ == 'nt': 1426 if _os.__name__ == 'nt':
1426 sys.meta_path.append(WindowsRegistryFinder) 1427 sys.meta_path.append(WindowsRegistryFinder)
1427 sys.meta_path.append(PathFinder) 1428 sys.meta_path.append(PathFinder)
1428 1429
1429 # XXX We expose a couple of classes in _bootstrap for the sake of 1430 # XXX We expose a couple of classes in _bootstrap for the sake of
1430 # a setuptools bug (https://bitbucket.org/pypa/setuptools/issue/378). 1431 # a setuptools bug (https://bitbucket.org/pypa/setuptools/issue/378).
1431 _bootstrap_module.FileFinder = FileFinder 1432 _bootstrap_module.FileFinder = FileFinder
1432 _bootstrap_module.SourceFileLoader = SourceFileLoader 1433 _bootstrap_module.SourceFileLoader = SourceFileLoader
OLDNEW

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+