Commit 42dc1c4
authored
Replace unsafe PY_*_VERSION comparisons to fix for Python 4.0 (#14280)
`#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7`
For example, this is true for Python 3.7-3.11 but also true for Python
4.7-4.11. Instead, `PY_VERSION_HEX` should be used.
https://docs.python.org/3.11/c-api/apiabiversion.html
```c
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
```
https://github.com/python/cpython/blob/2e279e85fece187b6058718ac7e82d1692461e26/Include/patchlevel.h#L29-L30
Remove compatibility code that only applied to EOL and unsupported
Python versions (<= 3.6)1 parent b0003af commit 42dc1c4
File tree
5 files changed
+7
-51
lines changed- mypyc
- lib-rt
- mypy
5 files changed
+7
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
1537 | | - | |
1538 | | - | |
1539 | 1536 | | |
1540 | 1537 | | |
1541 | 1538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 47 | | |
55 | 48 | | |
56 | 49 | | |
| |||
59 | 52 | | |
60 | 53 | | |
61 | 54 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 55 | + | |
| 56 | + | |
65 | 57 | | |
66 | 58 | | |
67 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
503 | | - | |
504 | | - | |
| 502 | + | |
505 | 503 | | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | 504 | | |
510 | 505 | | |
511 | 506 | | |
| |||
527 | 522 | | |
528 | 523 | | |
529 | 524 | | |
530 | | - | |
| 525 | + | |
531 | 526 | | |
532 | 527 | | |
533 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
570 | 567 | | |
571 | 568 | | |
572 | 569 | | |
573 | | - | |
574 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | 98 | | |
107 | 99 | | |
108 | | - | |
109 | 100 | | |
110 | 101 | | |
111 | 102 | | |
| |||
134 | 125 | | |
135 | 126 | | |
136 | 127 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | 128 | | |
146 | 129 | | |
147 | 130 | | |
| |||
306 | 289 | | |
307 | 290 | | |
308 | 291 | | |
309 | | - | |
| 292 | + | |
310 | 293 | | |
311 | 294 | | |
312 | 295 | | |
| |||
321 | 304 | | |
322 | 305 | | |
323 | 306 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | 307 | | |
330 | | - | |
331 | 308 | | |
332 | 309 | | |
333 | 310 | | |
| |||
390 | 367 | | |
391 | 368 | | |
392 | 369 | | |
393 | | - | |
| 370 | + | |
394 | 371 | | |
395 | 372 | | |
396 | 373 | | |
| |||
404 | 381 | | |
405 | 382 | | |
406 | 383 | | |
407 | | - | |
| 384 | + | |
408 | 385 | | |
409 | 386 | | |
410 | 387 | | |
| |||
0 commit comments