Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d0abb9

Browse files
committed
Issue #26073: Updates magic number comment in _bootstrap_external.py and changes numbers in launcher.py to decimal to match official table.
2 parents 0b39a55 + 7ae61af commit 8d0abb9

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

Lib/importlib/_bootstrap_external.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ def _write_atomic(path, data, mode=0o666):
229229
# MAGIC must change whenever the bytecode emitted by the compiler may no
230230
# longer be understood by older implementations of the eval loop (usually
231231
# due to the addition of new opcodes).
232+
#
233+
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
234+
# in PC/launcher.c must also be updated.
232235

233236
MAGIC_NUMBER = (3361).to_bytes(2, 'little') + b'\r\n'
234237
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c

PC/launcher.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,21 +1068,21 @@ typedef struct {
10681068
} PYC_MAGIC;
10691069

10701070
static PYC_MAGIC magic_values[] = {
1071-
{ 0xc687, 0xc687, L"2.0" },
1072-
{ 0xeb2a, 0xeb2a, L"2.1" },
1073-
{ 0xed2d, 0xed2d, L"2.2" },
1074-
{ 0xf23b, 0xf245, L"2.3" },
1075-
{ 0xf259, 0xf26d, L"2.4" },
1076-
{ 0xf277, 0xf2b3, L"2.5" },
1077-
{ 0xf2c7, 0xf2d1, L"2.6" },
1078-
{ 0xf2db, 0xf303, L"2.7" },
1079-
{ 0x0bb8, 0x0c3b, L"3.0" },
1080-
{ 0x0c45, 0x0c4f, L"3.1" },
1081-
{ 0x0c58, 0x0c6c, L"3.2" },
1082-
{ 0x0c76, 0x0c9e, L"3.3" },
1083-
{ 0x0cb2, 0x0cee, L"3.4" },
1084-
{ 0x0cf8, 0x0d16, L"3.5" },
1085-
{ 0x0d20, 0x0d20, L"3.6" },
1071+
{ 50823, 50823, L"2.0" },
1072+
{ 60202, 60202, L"2.1" },
1073+
{ 60717, 60717, L"2.2" },
1074+
{ 62011, 62021, L"2.3" },
1075+
{ 62041, 62061, L"2.4" },
1076+
{ 62071, 62131, L"2.5" },
1077+
{ 62151, 62161, L"2.6" },
1078+
{ 62171, 62211, L"2.7" },
1079+
{ 3000, 3131, L"3.0" },
1080+
{ 3141, 3151, L"3.1" },
1081+
{ 3160, 3180, L"3.2" },
1082+
{ 3190, 3230, L"3.3" },
1083+
{ 3250, 3310, L"3.4" },
1084+
{ 3320, 3350, L"3.5" },
1085+
{ 3350, 3350, L"3.6" },
10861086
{ 0 }
10871087
};
10881088

0 commit comments

Comments
 (0)