Skip to content

Commit 0aa2337

Browse files
committed
Modernize comment
1 parent 7af28b3 commit 0aa2337

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

Include/internal/pycore_magic_number.h

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,20 @@ extern "C" {
1010

1111
/*
1212
13-
Magic word to reject .pyc files generated by other Python versions.
13+
Magic number to reject .pyc files generated by other Python versions.
1414
It should change for each incompatible change to the bytecode.
1515
16+
PYC_MAGIC_NUMBER must change whenever the bytecode emitted by the compiler may
17+
no longer be understood by older implementations of the eval loop (usually due
18+
to the addition of new opcodes).
19+
1620
The value of CR and LF is incorporated so if you ever read or write
1721
a .pyc file in text mode the magic number will be wrong; also, the
1822
Apple MPW compiler swaps their values, botching string constants.
1923
20-
There were a variety of old schemes for setting the magic number.
21-
The current working scheme is to increment the previous value by
22-
10.
23-
24-
Starting with the adoption of PEP 3147 in Python 3.2, every bump in magic
25-
number also includes a new "magic tag", i.e. a human readable string used
26-
to represent the magic number in __pycache__ directories. When you change
27-
the magic number, you must also set a new unique magic tag. Generally this
28-
can be named after the Python major version of the magic number bump, but
29-
it can really be anything, as long as it's different than anything else
30-
that's come before. The tags are included in the following table, starting
31-
with Python 3.2a0.
24+
There were a variety of old schemes for setting the magic number. Starting with
25+
Python 3.11, Python 3.n starts with magic number 2900+50n. Within each minor
26+
version, the magic number is incremented by 1 each time the file format changes.
3227
3328
Known values:
3429
Python 1.5: 20121
@@ -86,9 +81,7 @@ Known values:
8681
introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE
8782
#4715)
8883
Python 3.2a1: 3160 (add SETUP_WITH #6101)
89-
tag: cpython-32
9084
Python 3.2a2: 3170 (add DUP_TOP_TWO, remove DUP_TOPX and ROT_FOUR #9225)
91-
tag: cpython-32
9285
Python 3.2a3 3180 (add DELETE_DEREF #4617)
9386
Python 3.3a1 3190 (__class__ super closure changed)
9487
Python 3.3a1 3200 (PEP 3155 __qualname__ added #13448)
@@ -269,14 +262,8 @@ Known values:
269262
You should always use the *upcoming* tag. For example, if 3.12a6 came out
270263
a week ago, I should put "Python 3.12a7" next to my new magic number.
271264
272-
MAGIC must change whenever the bytecode emitted by the compiler may no
273-
longer be understood by older implementations of the eval loop (usually
274-
due to the addition of new opcodes).
275-
276-
Starting with Python 3.11, Python 3.n starts with magic number 2900+50n.
277-
278-
Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
279-
in PC/launcher.c must also be updated.
265+
Whenever PYC_MAGIC_NUMBER is changed, the ranges in the magic_values array in
266+
PC/launcher.c must also be updated.
280267
281268
*/
282269

0 commit comments

Comments
 (0)