Commit d48760b
authored
When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. .
member = object.__new__(cls)
member = int.__new__(cls, value)
member = str.__new__(cls, value)
Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected.
1 parent 13a0007 commit d48760b
File tree
4 files changed
+260
-56
lines changed- Doc/howto
- Lib
- test
- Misc/NEWS.d/next/Library
4 files changed
+260
-56
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
433 | 440 | | |
434 | 441 | | |
435 | 442 | | |
| |||
895 | 902 | | |
896 | 903 | | |
897 | 904 | | |
| 905 | + | |
| 906 | + | |
898 | 907 | | |
899 | 908 | | |
900 | 909 | | |
| |||
927 | 936 | | |
928 | 937 | | |
929 | 938 | | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
930 | 944 | | |
931 | 945 | | |
932 | 946 | | |
| |||
1353 | 1367 | | |
1354 | 1368 | | |
1355 | 1369 | | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1356 | 1377 | | |
1357 | 1378 | | |
1358 | 1379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
| 859 | + | |
| 860 | + | |
859 | 861 | | |
860 | 862 | | |
861 | 863 | | |
| |||
1112 | 1114 | | |
1113 | 1115 | | |
1114 | 1116 | | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
1115 | 1122 | | |
1116 | 1123 | | |
1117 | 1124 | | |
| |||
0 commit comments