From 7ae61af8278c9a27caf508d6dece62bd4f5f552f Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 16 May 2016 09:34:20 -0700 Subject: [PATCH] Issue #26073: Updates magic number comment in _bootstrap_external.py and changes numbers in launcher.py to decimal to match official table. --- Lib/importlib/_bootstrap_external.py | 3 +++ PC/launcher.c | 30 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 616b17f89a8..ef13fd2f477 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -227,6 +227,9 @@ _code_type = type(_write_atomic.__code__) # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually # due to the addition of new opcodes). +# +# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array +# in PC/launcher.c must also be updated. MAGIC_NUMBER = (3350).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c diff --git a/PC/launcher.c b/PC/launcher.c index 8aef49a6288..6297ed72d60 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1068,21 +1068,21 @@ typedef struct { } PYC_MAGIC; static PYC_MAGIC magic_values[] = { - { 0xc687, 0xc687, L"2.0" }, - { 0xeb2a, 0xeb2a, L"2.1" }, - { 0xed2d, 0xed2d, L"2.2" }, - { 0xf23b, 0xf245, L"2.3" }, - { 0xf259, 0xf26d, L"2.4" }, - { 0xf277, 0xf2b3, L"2.5" }, - { 0xf2c7, 0xf2d1, L"2.6" }, - { 0xf2db, 0xf303, L"2.7" }, - { 0x0bb8, 0x0c3b, L"3.0" }, - { 0x0c45, 0x0c4f, L"3.1" }, - { 0x0c58, 0x0c6c, L"3.2" }, - { 0x0c76, 0x0c9e, L"3.3" }, - { 0x0cb2, 0x0cee, L"3.4" }, - { 0x0cf8, 0x0d16, L"3.5" }, - { 0x0d20, 0x0d20, L"3.6" }, + { 50823, 50823, L"2.0" }, + { 60202, 60202, L"2.1" }, + { 60717, 60717, L"2.2" }, + { 62011, 62021, L"2.3" }, + { 62041, 62061, L"2.4" }, + { 62071, 62131, L"2.5" }, + { 62151, 62161, L"2.6" }, + { 62171, 62211, L"2.7" }, + { 3000, 3131, L"3.0" }, + { 3141, 3151, L"3.1" }, + { 3160, 3180, L"3.2" }, + { 3190, 3230, L"3.3" }, + { 3250, 3310, L"3.4" }, + { 3320, 3350, L"3.5" }, + { 3350, 3350, L"3.6" }, { 0 } };