diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb2e96d719b589..6769cdd4531a0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -691,7 +691,6 @@ jobs: - build-ubuntu - build-ubuntu-ssltests-awslc - build-ubuntu-ssltests-openssl - - build-android - build-ios - build-wasi - test-hypothesis @@ -706,6 +705,7 @@ jobs: uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe with: allowed-failures: >- + build-android, build-windows-msi, build-ubuntu-ssltests-awslc, build-ubuntu-ssltests-openssl, diff --git a/Doc/deprecations/index.rst b/Doc/deprecations/index.rst index f3cecb321d633f..c91c64a1092457 100644 --- a/Doc/deprecations/index.rst +++ b/Doc/deprecations/index.rst @@ -7,6 +7,8 @@ Deprecations .. include:: pending-removal-in-3.17.rst +.. include:: pending-removal-in-3.18.rst + .. include:: pending-removal-in-3.19.rst .. include:: pending-removal-in-3.20.rst diff --git a/Doc/deprecations/pending-removal-in-3.18.rst b/Doc/deprecations/pending-removal-in-3.18.rst new file mode 100644 index 00000000000000..3e799219478424 --- /dev/null +++ b/Doc/deprecations/pending-removal-in-3.18.rst @@ -0,0 +1,9 @@ +Pending removal in Python 3.18 +------------------------------ + +* :mod:`decimal`: + + * The non-standard and undocumented :class:`~decimal.Decimal` format + specifier ``'N'``, which is only supported in the :mod:`!decimal` module's + C implementation, has been deprecated since Python 3.13. + (Contributed by Serhiy Storchaka in :gh:`89902`.) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index f75ad4e67a66d7..c766aa4afc8a56 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1556,6 +1556,15 @@ or `the MSDN `_ on Windo .. versionadded:: 3.15 +.. data:: RWF_ATOMIC + + Write data atomically. Requires alignment to the device's atomic write unit. + + .. availability:: Linux >= 6.11 + + .. versionadded:: next + + .. function:: ptsname(fd, /) Return the name of the slave pseudo-terminal device associated with the @@ -1598,6 +1607,7 @@ or `the MSDN `_ on Windo - :data:`RWF_SYNC` - :data:`RWF_APPEND` - :data:`RWF_DONTCACHE` + - :data:`RWF_ATOMIC` Return the total number of bytes actually written. @@ -1969,7 +1979,8 @@ can be inherited by child processes. Since Python 3.4, file descriptors created by Python are non-inheritable by default. On UNIX, non-inheritable file descriptors are closed in child processes at the -execution of a new program, other file descriptors are inherited. +execution of a new program, other file descriptors are inherited. Note that +non-inheritable file descriptors are still *inherited* by child processes on :func:`os.fork`. On Windows, non-inheritable handles and file descriptors are closed in child processes, except for standard streams (file descriptors 0, 1 and 2: stdin, stdout diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 7eaa9f48ab5bc4..d77d7310020195 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2190,6 +2190,15 @@ expression support in the :mod:`re` module). Nonprintable characters are those in group Separator or Other (Z or C), except the ASCII space. + For example: + + .. doctest:: + + >>> ''.isprintable(), ' '.isprintable() + (True, True) + >>> '\t'.isprintable(), '\n'.isprintable() + (False, False) + .. method:: str.isspace() diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index f0a81a093b435b..9d26f47820b134 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -225,8 +225,9 @@ The module defines the following user-callable items: properly implements the :const:`os.O_EXCL` flag for :func:`os.open`. The file is readable and writable only by the creating user ID. If the platform uses permission bits to indicate whether a file is executable, - the file is executable by no one. The file descriptor is not inherited - by child processes. + the file is executable by no one. + + The file descriptor is :ref:`not inherited by child processes `. Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible for deleting the temporary file when done with it. diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index dc105156f33080..3be6dcb3eacad2 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -1861,6 +1861,7 @@ New Deprecations * Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C implementation. + Scheduled to be removed in Python 3.18. (Contributed by Serhiy Storchaka in :gh:`89902`.) * :mod:`dis`: @@ -2024,6 +2025,8 @@ New Deprecations .. include:: ../deprecations/pending-removal-in-3.17.rst +.. include:: ../deprecations/pending-removal-in-3.18.rst + .. include:: ../deprecations/pending-removal-in-3.19.rst .. include:: ../deprecations/pending-removal-in-3.20.rst diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index c12a1920b10722..d4517183d697f1 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -2718,6 +2718,8 @@ New deprecations .. include:: ../deprecations/pending-removal-in-3.17.rst +.. include:: ../deprecations/pending-removal-in-3.18.rst + .. include:: ../deprecations/pending-removal-in-3.19.rst .. include:: ../deprecations/pending-removal-in-3.20.rst diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 39d6fb6572c834..6cb96c074c78f3 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -891,7 +891,11 @@ Results from the `pyperformance `__ benchmark suite report `3-4% `__ geometric mean performance improvement for the JIT over the standard CPython -interpreter built with all optimizations enabled. The speedups for JIT +interpreter built with all optimizations enabled on x86-64 Linux. On AArch64 +macOS, the JIT has a +`7-8% `__ +speedup over the :ref:`tail calling interpreter ` +with all optimizations enabled. The speedups for JIT builds versus no JIT builds range from roughly 20% slowdown to over 100% speedup (ignoring the ``unpack_sequence`` microbenchmark) on x86-64 Linux and AArch64 macOS systems. @@ -1171,6 +1175,8 @@ New deprecations .. include:: ../deprecations/pending-removal-in-3.17.rst +.. include:: ../deprecations/pending-removal-in-3.18.rst + .. include:: ../deprecations/pending-removal-in-3.19.rst .. include:: ../deprecations/pending-removal-in-3.20.rst diff --git a/Include/internal/pycore_opcode_metadata.h b/Include/internal/pycore_opcode_metadata.h index 7832ca9ae7f066..3f39ce2aaf6b56 100644 --- a/Include/internal/pycore_opcode_metadata.h +++ b/Include/internal/pycore_opcode_metadata.h @@ -1503,7 +1503,7 @@ _PyOpcode_macro_expansion[256] = { [STORE_SUBSCR_LIST_INT] = { .nuops = 5, .uops = { { _GUARD_TOS_INT, OPARG_SIMPLE, 0 }, { _GUARD_NOS_LIST, OPARG_SIMPLE, 0 }, { _STORE_SUBSCR_LIST_INT, OPARG_SIMPLE, 1 }, { _POP_TOP_INT, OPARG_SIMPLE, 1 }, { _POP_TOP, OPARG_SIMPLE, 1 } } }, [SWAP] = { .nuops = 1, .uops = { { _SWAP, OPARG_SIMPLE, 0 } } }, [TO_BOOL] = { .nuops = 1, .uops = { { _TO_BOOL, OPARG_SIMPLE, 2 } } }, - [TO_BOOL_ALWAYS_TRUE] = { .nuops = 2, .uops = { { _GUARD_TYPE_VERSION, 2, 1 }, { _REPLACE_WITH_TRUE, OPARG_SIMPLE, 3 } } }, + [TO_BOOL_ALWAYS_TRUE] = { .nuops = 3, .uops = { { _GUARD_TYPE_VERSION, 2, 1 }, { _REPLACE_WITH_TRUE, OPARG_SIMPLE, 3 }, { _POP_TOP, OPARG_SIMPLE, 3 } } }, [TO_BOOL_BOOL] = { .nuops = 1, .uops = { { _TO_BOOL_BOOL, OPARG_SIMPLE, 3 } } }, [TO_BOOL_INT] = { .nuops = 1, .uops = { { _TO_BOOL_INT, OPARG_SIMPLE, 3 } } }, [TO_BOOL_LIST] = { .nuops = 2, .uops = { { _GUARD_TOS_LIST, OPARG_SIMPLE, 0 }, { _TO_BOOL_LIST, OPARG_SIMPLE, 3 } } }, diff --git a/Include/internal/pycore_tstate.h b/Include/internal/pycore_tstate.h index 27299d1ebcb57a..d8f4bfef98af7e 100644 --- a/Include/internal/pycore_tstate.h +++ b/Include/internal/pycore_tstate.h @@ -47,10 +47,15 @@ typedef struct _PyJitTracerPreviousState { _PyBloomFilter dependencies; } _PyJitTracerPreviousState; +typedef struct _PyJitTracerTranslatorState { + int jump_backward_seen; +} _PyJitTracerTranslatorState; + typedef struct _PyJitTracerState { _PyUOpInstruction *code_buffer; _PyJitTracerInitialState initial_state; _PyJitTracerPreviousState prev_state; + _PyJitTracerTranslatorState translator_state; } _PyJitTracerState; #endif diff --git a/Include/internal/pycore_uop_ids.h b/Include/internal/pycore_uop_ids.h index ad170592dc2584..0c17f9c548b847 100644 --- a/Include/internal/pycore_uop_ids.h +++ b/Include/internal/pycore_uop_ids.h @@ -181,7 +181,8 @@ extern "C" { #define _INIT_CALL_PY_EXACT_ARGS_2 434 #define _INIT_CALL_PY_EXACT_ARGS_3 435 #define _INIT_CALL_PY_EXACT_ARGS_4 436 -#define _INSERT_NULL 437 +#define _INSERT_1_LOAD_CONST_INLINE_BORROW 437 +#define _INSERT_NULL 438 #define _INSTRUMENTED_FOR_ITER INSTRUMENTED_FOR_ITER #define _INSTRUMENTED_INSTRUCTION INSTRUMENTED_INSTRUCTION #define _INSTRUMENTED_JUMP_FORWARD INSTRUMENTED_JUMP_FORWARD @@ -191,970 +192,975 @@ extern "C" { #define _INSTRUMENTED_POP_JUMP_IF_NONE INSTRUMENTED_POP_JUMP_IF_NONE #define _INSTRUMENTED_POP_JUMP_IF_NOT_NONE INSTRUMENTED_POP_JUMP_IF_NOT_NONE #define _INSTRUMENTED_POP_JUMP_IF_TRUE INSTRUMENTED_POP_JUMP_IF_TRUE -#define _IS_NONE 438 -#define _IS_OP 439 -#define _ITER_CHECK_LIST 440 -#define _ITER_CHECK_RANGE 441 -#define _ITER_CHECK_TUPLE 442 -#define _ITER_JUMP_LIST 443 -#define _ITER_JUMP_RANGE 444 -#define _ITER_JUMP_TUPLE 445 -#define _ITER_NEXT_LIST 446 -#define _ITER_NEXT_LIST_TIER_TWO 447 -#define _ITER_NEXT_RANGE 448 -#define _ITER_NEXT_TUPLE 449 +#define _IS_NONE 439 +#define _IS_OP 440 +#define _ITER_CHECK_LIST 441 +#define _ITER_CHECK_RANGE 442 +#define _ITER_CHECK_TUPLE 443 +#define _ITER_JUMP_LIST 444 +#define _ITER_JUMP_RANGE 445 +#define _ITER_JUMP_TUPLE 446 +#define _ITER_NEXT_LIST 447 +#define _ITER_NEXT_LIST_TIER_TWO 448 +#define _ITER_NEXT_RANGE 449 +#define _ITER_NEXT_TUPLE 450 #define _JUMP_BACKWARD_NO_INTERRUPT JUMP_BACKWARD_NO_INTERRUPT -#define _JUMP_TO_TOP 450 +#define _JUMP_TO_TOP 451 #define _LIST_APPEND LIST_APPEND #define _LIST_EXTEND LIST_EXTEND -#define _LOAD_ATTR 451 -#define _LOAD_ATTR_CLASS 452 +#define _LOAD_ATTR 452 +#define _LOAD_ATTR_CLASS 453 #define _LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN -#define _LOAD_ATTR_INSTANCE_VALUE 453 -#define _LOAD_ATTR_METHOD_LAZY_DICT 454 -#define _LOAD_ATTR_METHOD_NO_DICT 455 -#define _LOAD_ATTR_METHOD_WITH_VALUES 456 -#define _LOAD_ATTR_MODULE 457 -#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT 458 -#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES 459 -#define _LOAD_ATTR_PROPERTY_FRAME 460 -#define _LOAD_ATTR_SLOT 461 -#define _LOAD_ATTR_WITH_HINT 462 +#define _LOAD_ATTR_INSTANCE_VALUE 454 +#define _LOAD_ATTR_METHOD_LAZY_DICT 455 +#define _LOAD_ATTR_METHOD_NO_DICT 456 +#define _LOAD_ATTR_METHOD_WITH_VALUES 457 +#define _LOAD_ATTR_MODULE 458 +#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT 459 +#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES 460 +#define _LOAD_ATTR_PROPERTY_FRAME 461 +#define _LOAD_ATTR_SLOT 462 +#define _LOAD_ATTR_WITH_HINT 463 #define _LOAD_BUILD_CLASS LOAD_BUILD_CLASS -#define _LOAD_BYTECODE 463 +#define _LOAD_BYTECODE 464 #define _LOAD_COMMON_CONSTANT LOAD_COMMON_CONSTANT #define _LOAD_CONST LOAD_CONST -#define _LOAD_CONST_INLINE 464 -#define _LOAD_CONST_INLINE_BORROW 465 -#define _LOAD_CONST_UNDER_INLINE 466 -#define _LOAD_CONST_UNDER_INLINE_BORROW 467 +#define _LOAD_CONST_INLINE 465 +#define _LOAD_CONST_INLINE_BORROW 466 +#define _LOAD_CONST_UNDER_INLINE 467 +#define _LOAD_CONST_UNDER_INLINE_BORROW 468 #define _LOAD_DEREF LOAD_DEREF -#define _LOAD_FAST 468 -#define _LOAD_FAST_0 469 -#define _LOAD_FAST_1 470 -#define _LOAD_FAST_2 471 -#define _LOAD_FAST_3 472 -#define _LOAD_FAST_4 473 -#define _LOAD_FAST_5 474 -#define _LOAD_FAST_6 475 -#define _LOAD_FAST_7 476 +#define _LOAD_FAST 469 +#define _LOAD_FAST_0 470 +#define _LOAD_FAST_1 471 +#define _LOAD_FAST_2 472 +#define _LOAD_FAST_3 473 +#define _LOAD_FAST_4 474 +#define _LOAD_FAST_5 475 +#define _LOAD_FAST_6 476 +#define _LOAD_FAST_7 477 #define _LOAD_FAST_AND_CLEAR LOAD_FAST_AND_CLEAR -#define _LOAD_FAST_BORROW 477 -#define _LOAD_FAST_BORROW_0 478 -#define _LOAD_FAST_BORROW_1 479 -#define _LOAD_FAST_BORROW_2 480 -#define _LOAD_FAST_BORROW_3 481 -#define _LOAD_FAST_BORROW_4 482 -#define _LOAD_FAST_BORROW_5 483 -#define _LOAD_FAST_BORROW_6 484 -#define _LOAD_FAST_BORROW_7 485 +#define _LOAD_FAST_BORROW 478 +#define _LOAD_FAST_BORROW_0 479 +#define _LOAD_FAST_BORROW_1 480 +#define _LOAD_FAST_BORROW_2 481 +#define _LOAD_FAST_BORROW_3 482 +#define _LOAD_FAST_BORROW_4 483 +#define _LOAD_FAST_BORROW_5 484 +#define _LOAD_FAST_BORROW_6 485 +#define _LOAD_FAST_BORROW_7 486 #define _LOAD_FAST_CHECK LOAD_FAST_CHECK #define _LOAD_FROM_DICT_OR_DEREF LOAD_FROM_DICT_OR_DEREF #define _LOAD_FROM_DICT_OR_GLOBALS LOAD_FROM_DICT_OR_GLOBALS -#define _LOAD_GLOBAL 486 -#define _LOAD_GLOBAL_BUILTINS 487 -#define _LOAD_GLOBAL_MODULE 488 +#define _LOAD_GLOBAL 487 +#define _LOAD_GLOBAL_BUILTINS 488 +#define _LOAD_GLOBAL_MODULE 489 #define _LOAD_LOCALS LOAD_LOCALS #define _LOAD_NAME LOAD_NAME -#define _LOAD_SMALL_INT 489 -#define _LOAD_SMALL_INT_0 490 -#define _LOAD_SMALL_INT_1 491 -#define _LOAD_SMALL_INT_2 492 -#define _LOAD_SMALL_INT_3 493 -#define _LOAD_SPECIAL 494 +#define _LOAD_SMALL_INT 490 +#define _LOAD_SMALL_INT_0 491 +#define _LOAD_SMALL_INT_1 492 +#define _LOAD_SMALL_INT_2 493 +#define _LOAD_SMALL_INT_3 494 +#define _LOAD_SPECIAL 495 #define _LOAD_SUPER_ATTR_ATTR LOAD_SUPER_ATTR_ATTR #define _LOAD_SUPER_ATTR_METHOD LOAD_SUPER_ATTR_METHOD -#define _MAKE_CALLARGS_A_TUPLE 495 +#define _MAKE_CALLARGS_A_TUPLE 496 #define _MAKE_CELL MAKE_CELL #define _MAKE_FUNCTION MAKE_FUNCTION -#define _MAKE_WARM 496 +#define _MAKE_WARM 497 #define _MAP_ADD MAP_ADD #define _MATCH_CLASS MATCH_CLASS #define _MATCH_KEYS MATCH_KEYS #define _MATCH_MAPPING MATCH_MAPPING #define _MATCH_SEQUENCE MATCH_SEQUENCE -#define _MAYBE_EXPAND_METHOD 497 -#define _MAYBE_EXPAND_METHOD_KW 498 -#define _MONITOR_CALL 499 -#define _MONITOR_CALL_KW 500 -#define _MONITOR_JUMP_BACKWARD 501 -#define _MONITOR_RESUME 502 +#define _MAYBE_EXPAND_METHOD 498 +#define _MAYBE_EXPAND_METHOD_KW 499 +#define _MONITOR_CALL 500 +#define _MONITOR_CALL_KW 501 +#define _MONITOR_JUMP_BACKWARD 502 +#define _MONITOR_RESUME 503 #define _NOP NOP -#define _POP_CALL 503 -#define _POP_CALL_LOAD_CONST_INLINE_BORROW 504 -#define _POP_CALL_ONE 505 -#define _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW 506 -#define _POP_CALL_TWO 507 -#define _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW 508 +#define _POP_CALL 504 +#define _POP_CALL_LOAD_CONST_INLINE_BORROW 505 +#define _POP_CALL_ONE 506 +#define _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW 507 +#define _POP_CALL_TWO 508 +#define _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW 509 #define _POP_EXCEPT POP_EXCEPT #define _POP_ITER POP_ITER -#define _POP_JUMP_IF_FALSE 509 -#define _POP_JUMP_IF_TRUE 510 +#define _POP_JUMP_IF_FALSE 510 +#define _POP_JUMP_IF_TRUE 511 #define _POP_TOP POP_TOP -#define _POP_TOP_FLOAT 511 -#define _POP_TOP_INT 512 -#define _POP_TOP_LOAD_CONST_INLINE 513 -#define _POP_TOP_LOAD_CONST_INLINE_BORROW 514 -#define _POP_TOP_NOP 515 -#define _POP_TOP_UNICODE 516 -#define _POP_TWO 517 -#define _POP_TWO_LOAD_CONST_INLINE_BORROW 518 +#define _POP_TOP_FLOAT 512 +#define _POP_TOP_INT 513 +#define _POP_TOP_LOAD_CONST_INLINE 514 +#define _POP_TOP_LOAD_CONST_INLINE_BORROW 515 +#define _POP_TOP_NOP 516 +#define _POP_TOP_UNICODE 517 +#define _POP_TWO 518 +#define _POP_TWO_LOAD_CONST_INLINE_BORROW 519 #define _PUSH_EXC_INFO PUSH_EXC_INFO -#define _PUSH_FRAME 519 +#define _PUSH_FRAME 520 #define _PUSH_NULL PUSH_NULL -#define _PUSH_NULL_CONDITIONAL 520 -#define _PY_FRAME_GENERAL 521 -#define _PY_FRAME_KW 522 -#define _QUICKEN_RESUME 523 -#define _REPLACE_WITH_TRUE 524 +#define _PUSH_NULL_CONDITIONAL 521 +#define _PY_FRAME_GENERAL 522 +#define _PY_FRAME_KW 523 +#define _QUICKEN_RESUME 524 +#define _REPLACE_WITH_TRUE 525 #define _RESUME_CHECK RESUME_CHECK #define _RETURN_GENERATOR RETURN_GENERATOR #define _RETURN_VALUE RETURN_VALUE -#define _SAVE_RETURN_OFFSET 525 -#define _SEND 526 -#define _SEND_GEN_FRAME 527 +#define _SAVE_RETURN_OFFSET 526 +#define _SEND 527 +#define _SEND_GEN_FRAME 528 #define _SETUP_ANNOTATIONS SETUP_ANNOTATIONS #define _SET_ADD SET_ADD #define _SET_FUNCTION_ATTRIBUTE SET_FUNCTION_ATTRIBUTE #define _SET_UPDATE SET_UPDATE -#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW 528 -#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW 529 -#define _SPILL_OR_RELOAD 530 -#define _START_EXECUTOR 531 -#define _STORE_ATTR 532 -#define _STORE_ATTR_INSTANCE_VALUE 533 -#define _STORE_ATTR_SLOT 534 -#define _STORE_ATTR_WITH_HINT 535 +#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW 529 +#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW 530 +#define _SPILL_OR_RELOAD 531 +#define _START_EXECUTOR 532 +#define _STORE_ATTR 533 +#define _STORE_ATTR_INSTANCE_VALUE 534 +#define _STORE_ATTR_SLOT 535 +#define _STORE_ATTR_WITH_HINT 536 #define _STORE_DEREF STORE_DEREF #define _STORE_GLOBAL STORE_GLOBAL #define _STORE_NAME STORE_NAME -#define _STORE_SLICE 536 -#define _STORE_SUBSCR 537 -#define _STORE_SUBSCR_DICT 538 -#define _STORE_SUBSCR_LIST_INT 539 -#define _SWAP 540 -#define _SWAP_2 541 -#define _SWAP_3 542 -#define _SWAP_FAST 543 -#define _SWAP_FAST_0 544 -#define _SWAP_FAST_1 545 -#define _SWAP_FAST_2 546 -#define _SWAP_FAST_3 547 -#define _SWAP_FAST_4 548 -#define _SWAP_FAST_5 549 -#define _SWAP_FAST_6 550 -#define _SWAP_FAST_7 551 -#define _TIER2_RESUME_CHECK 552 -#define _TO_BOOL 553 +#define _STORE_SLICE 537 +#define _STORE_SUBSCR 538 +#define _STORE_SUBSCR_DICT 539 +#define _STORE_SUBSCR_LIST_INT 540 +#define _SWAP 541 +#define _SWAP_2 542 +#define _SWAP_3 543 +#define _SWAP_FAST 544 +#define _SWAP_FAST_0 545 +#define _SWAP_FAST_1 546 +#define _SWAP_FAST_2 547 +#define _SWAP_FAST_3 548 +#define _SWAP_FAST_4 549 +#define _SWAP_FAST_5 550 +#define _SWAP_FAST_6 551 +#define _SWAP_FAST_7 552 +#define _TIER2_RESUME_CHECK 553 +#define _TO_BOOL 554 #define _TO_BOOL_BOOL TO_BOOL_BOOL #define _TO_BOOL_INT TO_BOOL_INT -#define _TO_BOOL_LIST 554 +#define _TO_BOOL_LIST 555 #define _TO_BOOL_NONE TO_BOOL_NONE -#define _TO_BOOL_STR 555 +#define _TO_BOOL_STR 556 #define _TRACE_RECORD TRACE_RECORD #define _UNARY_INVERT UNARY_INVERT #define _UNARY_NEGATIVE UNARY_NEGATIVE #define _UNARY_NOT UNARY_NOT #define _UNPACK_EX UNPACK_EX -#define _UNPACK_SEQUENCE 556 -#define _UNPACK_SEQUENCE_LIST 557 -#define _UNPACK_SEQUENCE_TUPLE 558 -#define _UNPACK_SEQUENCE_TWO_TUPLE 559 +#define _UNPACK_SEQUENCE 557 +#define _UNPACK_SEQUENCE_LIST 558 +#define _UNPACK_SEQUENCE_TUPLE 559 +#define _UNPACK_SEQUENCE_TWO_TUPLE 560 #define _WITH_EXCEPT_START WITH_EXCEPT_START #define _YIELD_VALUE YIELD_VALUE -#define MAX_UOP_ID 559 -#define _BINARY_OP_r21 560 -#define _BINARY_OP_ADD_FLOAT_r03 561 -#define _BINARY_OP_ADD_FLOAT_r13 562 -#define _BINARY_OP_ADD_FLOAT_r23 563 -#define _BINARY_OP_ADD_INT_r03 564 -#define _BINARY_OP_ADD_INT_r13 565 -#define _BINARY_OP_ADD_INT_r23 566 -#define _BINARY_OP_ADD_UNICODE_r03 567 -#define _BINARY_OP_ADD_UNICODE_r13 568 -#define _BINARY_OP_ADD_UNICODE_r23 569 -#define _BINARY_OP_EXTEND_r21 570 -#define _BINARY_OP_INPLACE_ADD_UNICODE_r21 571 -#define _BINARY_OP_MULTIPLY_FLOAT_r03 572 -#define _BINARY_OP_MULTIPLY_FLOAT_r13 573 -#define _BINARY_OP_MULTIPLY_FLOAT_r23 574 -#define _BINARY_OP_MULTIPLY_INT_r03 575 -#define _BINARY_OP_MULTIPLY_INT_r13 576 -#define _BINARY_OP_MULTIPLY_INT_r23 577 -#define _BINARY_OP_SUBSCR_CHECK_FUNC_r23 578 -#define _BINARY_OP_SUBSCR_DICT_r21 579 -#define _BINARY_OP_SUBSCR_INIT_CALL_r01 580 -#define _BINARY_OP_SUBSCR_INIT_CALL_r11 581 -#define _BINARY_OP_SUBSCR_INIT_CALL_r21 582 -#define _BINARY_OP_SUBSCR_INIT_CALL_r31 583 -#define _BINARY_OP_SUBSCR_LIST_INT_r23 584 -#define _BINARY_OP_SUBSCR_LIST_SLICE_r21 585 -#define _BINARY_OP_SUBSCR_STR_INT_r23 586 -#define _BINARY_OP_SUBSCR_TUPLE_INT_r03 587 -#define _BINARY_OP_SUBSCR_TUPLE_INT_r13 588 -#define _BINARY_OP_SUBSCR_TUPLE_INT_r23 589 -#define _BINARY_OP_SUBSCR_USTR_INT_r23 590 -#define _BINARY_OP_SUBTRACT_FLOAT_r03 591 -#define _BINARY_OP_SUBTRACT_FLOAT_r13 592 -#define _BINARY_OP_SUBTRACT_FLOAT_r23 593 -#define _BINARY_OP_SUBTRACT_INT_r03 594 -#define _BINARY_OP_SUBTRACT_INT_r13 595 -#define _BINARY_OP_SUBTRACT_INT_r23 596 -#define _BINARY_SLICE_r31 597 -#define _BUILD_INTERPOLATION_r01 598 -#define _BUILD_LIST_r01 599 -#define _BUILD_MAP_r01 600 -#define _BUILD_SET_r01 601 -#define _BUILD_SLICE_r01 602 -#define _BUILD_STRING_r01 603 -#define _BUILD_TEMPLATE_r21 604 -#define _BUILD_TUPLE_r01 605 -#define _CALL_BUILTIN_CLASS_r01 606 -#define _CALL_BUILTIN_FAST_r01 607 -#define _CALL_BUILTIN_FAST_WITH_KEYWORDS_r01 608 -#define _CALL_BUILTIN_O_r03 609 -#define _CALL_INTRINSIC_1_r11 610 -#define _CALL_INTRINSIC_2_r21 611 -#define _CALL_ISINSTANCE_r31 612 -#define _CALL_KW_NON_PY_r11 613 -#define _CALL_LEN_r33 614 -#define _CALL_LIST_APPEND_r03 615 -#define _CALL_LIST_APPEND_r13 616 -#define _CALL_LIST_APPEND_r23 617 -#define _CALL_LIST_APPEND_r33 618 -#define _CALL_METHOD_DESCRIPTOR_FAST_r01 619 -#define _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_r01 620 -#define _CALL_METHOD_DESCRIPTOR_NOARGS_r01 621 -#define _CALL_METHOD_DESCRIPTOR_O_r03 622 -#define _CALL_NON_PY_GENERAL_r01 623 -#define _CALL_STR_1_r32 624 -#define _CALL_TUPLE_1_r32 625 -#define _CALL_TYPE_1_r02 626 -#define _CALL_TYPE_1_r12 627 -#define _CALL_TYPE_1_r22 628 -#define _CALL_TYPE_1_r32 629 -#define _CHECK_AND_ALLOCATE_OBJECT_r00 630 -#define _CHECK_ATTR_CLASS_r01 631 -#define _CHECK_ATTR_CLASS_r11 632 -#define _CHECK_ATTR_CLASS_r22 633 -#define _CHECK_ATTR_CLASS_r33 634 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r01 635 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r11 636 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r22 637 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r33 638 -#define _CHECK_CALL_BOUND_METHOD_EXACT_ARGS_r00 639 -#define _CHECK_EG_MATCH_r22 640 -#define _CHECK_EXC_MATCH_r22 641 -#define _CHECK_FUNCTION_EXACT_ARGS_r00 642 -#define _CHECK_FUNCTION_VERSION_r00 643 -#define _CHECK_FUNCTION_VERSION_INLINE_r00 644 -#define _CHECK_FUNCTION_VERSION_INLINE_r11 645 -#define _CHECK_FUNCTION_VERSION_INLINE_r22 646 -#define _CHECK_FUNCTION_VERSION_INLINE_r33 647 -#define _CHECK_FUNCTION_VERSION_KW_r11 648 -#define _CHECK_IS_NOT_PY_CALLABLE_r00 649 -#define _CHECK_IS_NOT_PY_CALLABLE_KW_r11 650 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r01 651 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r11 652 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r22 653 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r33 654 -#define _CHECK_METHOD_VERSION_r00 655 -#define _CHECK_METHOD_VERSION_KW_r11 656 -#define _CHECK_PEP_523_r00 657 -#define _CHECK_PEP_523_r11 658 -#define _CHECK_PEP_523_r22 659 -#define _CHECK_PEP_523_r33 660 -#define _CHECK_PERIODIC_r00 661 -#define _CHECK_PERIODIC_AT_END_r00 662 -#define _CHECK_PERIODIC_IF_NOT_YIELD_FROM_r00 663 -#define _CHECK_RECURSION_REMAINING_r00 664 -#define _CHECK_RECURSION_REMAINING_r11 665 -#define _CHECK_RECURSION_REMAINING_r22 666 -#define _CHECK_RECURSION_REMAINING_r33 667 -#define _CHECK_STACK_SPACE_r00 668 -#define _CHECK_STACK_SPACE_OPERAND_r00 669 -#define _CHECK_STACK_SPACE_OPERAND_r11 670 -#define _CHECK_STACK_SPACE_OPERAND_r22 671 -#define _CHECK_STACK_SPACE_OPERAND_r33 672 -#define _CHECK_VALIDITY_r00 673 -#define _CHECK_VALIDITY_r11 674 -#define _CHECK_VALIDITY_r22 675 -#define _CHECK_VALIDITY_r33 676 -#define _COLD_DYNAMIC_EXIT_r00 677 -#define _COLD_EXIT_r00 678 -#define _COMPARE_OP_r21 679 -#define _COMPARE_OP_FLOAT_r03 680 -#define _COMPARE_OP_FLOAT_r13 681 -#define _COMPARE_OP_FLOAT_r23 682 -#define _COMPARE_OP_INT_r23 683 -#define _COMPARE_OP_STR_r23 684 -#define _CONTAINS_OP_r21 685 -#define _CONTAINS_OP_DICT_r21 686 -#define _CONTAINS_OP_SET_r21 687 -#define _CONVERT_VALUE_r11 688 -#define _COPY_r01 689 -#define _COPY_1_r02 690 -#define _COPY_1_r12 691 -#define _COPY_1_r23 692 -#define _COPY_2_r03 693 -#define _COPY_2_r13 694 -#define _COPY_2_r23 695 -#define _COPY_3_r03 696 -#define _COPY_3_r13 697 -#define _COPY_3_r23 698 -#define _COPY_3_r33 699 -#define _COPY_FREE_VARS_r00 700 -#define _COPY_FREE_VARS_r11 701 -#define _COPY_FREE_VARS_r22 702 -#define _COPY_FREE_VARS_r33 703 -#define _CREATE_INIT_FRAME_r01 704 -#define _DELETE_ATTR_r10 705 -#define _DELETE_DEREF_r00 706 -#define _DELETE_FAST_r00 707 -#define _DELETE_GLOBAL_r00 708 -#define _DELETE_NAME_r00 709 -#define _DELETE_SUBSCR_r20 710 -#define _DEOPT_r00 711 -#define _DEOPT_r10 712 -#define _DEOPT_r20 713 -#define _DEOPT_r30 714 -#define _DICT_MERGE_r10 715 -#define _DICT_UPDATE_r10 716 -#define _DO_CALL_r01 717 -#define _DO_CALL_FUNCTION_EX_r31 718 -#define _DO_CALL_KW_r11 719 -#define _DYNAMIC_EXIT_r00 720 -#define _DYNAMIC_EXIT_r10 721 -#define _DYNAMIC_EXIT_r20 722 -#define _DYNAMIC_EXIT_r30 723 -#define _END_FOR_r10 724 -#define _END_SEND_r21 725 -#define _ERROR_POP_N_r00 726 -#define _EXIT_INIT_CHECK_r10 727 -#define _EXIT_TRACE_r00 728 -#define _EXIT_TRACE_r10 729 -#define _EXIT_TRACE_r20 730 -#define _EXIT_TRACE_r30 731 -#define _EXPAND_METHOD_r00 732 -#define _EXPAND_METHOD_KW_r11 733 -#define _FATAL_ERROR_r00 734 -#define _FATAL_ERROR_r11 735 -#define _FATAL_ERROR_r22 736 -#define _FATAL_ERROR_r33 737 -#define _FORMAT_SIMPLE_r11 738 -#define _FORMAT_WITH_SPEC_r21 739 -#define _FOR_ITER_r23 740 -#define _FOR_ITER_GEN_FRAME_r03 741 -#define _FOR_ITER_GEN_FRAME_r13 742 -#define _FOR_ITER_GEN_FRAME_r23 743 -#define _FOR_ITER_TIER_TWO_r23 744 -#define _GET_AITER_r11 745 -#define _GET_ANEXT_r12 746 -#define _GET_AWAITABLE_r11 747 -#define _GET_ITER_r12 748 -#define _GET_LEN_r12 749 -#define _GET_YIELD_FROM_ITER_r11 750 -#define _GUARD_BINARY_OP_EXTEND_r22 751 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r02 752 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r12 753 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r22 754 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r33 755 -#define _GUARD_CALLABLE_ISINSTANCE_r03 756 -#define _GUARD_CALLABLE_ISINSTANCE_r13 757 -#define _GUARD_CALLABLE_ISINSTANCE_r23 758 -#define _GUARD_CALLABLE_ISINSTANCE_r33 759 -#define _GUARD_CALLABLE_LEN_r03 760 -#define _GUARD_CALLABLE_LEN_r13 761 -#define _GUARD_CALLABLE_LEN_r23 762 -#define _GUARD_CALLABLE_LEN_r33 763 -#define _GUARD_CALLABLE_LIST_APPEND_r03 764 -#define _GUARD_CALLABLE_LIST_APPEND_r13 765 -#define _GUARD_CALLABLE_LIST_APPEND_r23 766 -#define _GUARD_CALLABLE_LIST_APPEND_r33 767 -#define _GUARD_CALLABLE_STR_1_r03 768 -#define _GUARD_CALLABLE_STR_1_r13 769 -#define _GUARD_CALLABLE_STR_1_r23 770 -#define _GUARD_CALLABLE_STR_1_r33 771 -#define _GUARD_CALLABLE_TUPLE_1_r03 772 -#define _GUARD_CALLABLE_TUPLE_1_r13 773 -#define _GUARD_CALLABLE_TUPLE_1_r23 774 -#define _GUARD_CALLABLE_TUPLE_1_r33 775 -#define _GUARD_CALLABLE_TYPE_1_r03 776 -#define _GUARD_CALLABLE_TYPE_1_r13 777 -#define _GUARD_CALLABLE_TYPE_1_r23 778 -#define _GUARD_CALLABLE_TYPE_1_r33 779 -#define _GUARD_DORV_NO_DICT_r01 780 -#define _GUARD_DORV_NO_DICT_r11 781 -#define _GUARD_DORV_NO_DICT_r22 782 -#define _GUARD_DORV_NO_DICT_r33 783 -#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r01 784 -#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r11 785 -#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r22 786 -#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r33 787 -#define _GUARD_GLOBALS_VERSION_r00 788 -#define _GUARD_GLOBALS_VERSION_r11 789 -#define _GUARD_GLOBALS_VERSION_r22 790 -#define _GUARD_GLOBALS_VERSION_r33 791 -#define _GUARD_IP_RETURN_GENERATOR_r00 792 -#define _GUARD_IP_RETURN_GENERATOR_r11 793 -#define _GUARD_IP_RETURN_GENERATOR_r22 794 -#define _GUARD_IP_RETURN_GENERATOR_r33 795 -#define _GUARD_IP_RETURN_VALUE_r00 796 -#define _GUARD_IP_RETURN_VALUE_r11 797 -#define _GUARD_IP_RETURN_VALUE_r22 798 -#define _GUARD_IP_RETURN_VALUE_r33 799 -#define _GUARD_IP_YIELD_VALUE_r00 800 -#define _GUARD_IP_YIELD_VALUE_r11 801 -#define _GUARD_IP_YIELD_VALUE_r22 802 -#define _GUARD_IP_YIELD_VALUE_r33 803 -#define _GUARD_IP__PUSH_FRAME_r00 804 -#define _GUARD_IP__PUSH_FRAME_r11 805 -#define _GUARD_IP__PUSH_FRAME_r22 806 -#define _GUARD_IP__PUSH_FRAME_r33 807 -#define _GUARD_IS_FALSE_POP_r00 808 -#define _GUARD_IS_FALSE_POP_r10 809 -#define _GUARD_IS_FALSE_POP_r21 810 -#define _GUARD_IS_FALSE_POP_r32 811 -#define _GUARD_IS_NONE_POP_r00 812 -#define _GUARD_IS_NONE_POP_r10 813 -#define _GUARD_IS_NONE_POP_r21 814 -#define _GUARD_IS_NONE_POP_r32 815 -#define _GUARD_IS_NOT_NONE_POP_r10 816 -#define _GUARD_IS_TRUE_POP_r00 817 -#define _GUARD_IS_TRUE_POP_r10 818 -#define _GUARD_IS_TRUE_POP_r21 819 -#define _GUARD_IS_TRUE_POP_r32 820 -#define _GUARD_KEYS_VERSION_r01 821 -#define _GUARD_KEYS_VERSION_r11 822 -#define _GUARD_KEYS_VERSION_r22 823 -#define _GUARD_KEYS_VERSION_r33 824 -#define _GUARD_NOS_COMPACT_ASCII_r02 825 -#define _GUARD_NOS_COMPACT_ASCII_r12 826 -#define _GUARD_NOS_COMPACT_ASCII_r22 827 -#define _GUARD_NOS_COMPACT_ASCII_r33 828 -#define _GUARD_NOS_DICT_r02 829 -#define _GUARD_NOS_DICT_r12 830 -#define _GUARD_NOS_DICT_r22 831 -#define _GUARD_NOS_DICT_r33 832 -#define _GUARD_NOS_FLOAT_r02 833 -#define _GUARD_NOS_FLOAT_r12 834 -#define _GUARD_NOS_FLOAT_r22 835 -#define _GUARD_NOS_FLOAT_r33 836 -#define _GUARD_NOS_INT_r02 837 -#define _GUARD_NOS_INT_r12 838 -#define _GUARD_NOS_INT_r22 839 -#define _GUARD_NOS_INT_r33 840 -#define _GUARD_NOS_LIST_r02 841 -#define _GUARD_NOS_LIST_r12 842 -#define _GUARD_NOS_LIST_r22 843 -#define _GUARD_NOS_LIST_r33 844 -#define _GUARD_NOS_NOT_NULL_r02 845 -#define _GUARD_NOS_NOT_NULL_r12 846 -#define _GUARD_NOS_NOT_NULL_r22 847 -#define _GUARD_NOS_NOT_NULL_r33 848 -#define _GUARD_NOS_NULL_r02 849 -#define _GUARD_NOS_NULL_r12 850 -#define _GUARD_NOS_NULL_r22 851 -#define _GUARD_NOS_NULL_r33 852 -#define _GUARD_NOS_OVERFLOWED_r02 853 -#define _GUARD_NOS_OVERFLOWED_r12 854 -#define _GUARD_NOS_OVERFLOWED_r22 855 -#define _GUARD_NOS_OVERFLOWED_r33 856 -#define _GUARD_NOS_TUPLE_r02 857 -#define _GUARD_NOS_TUPLE_r12 858 -#define _GUARD_NOS_TUPLE_r22 859 -#define _GUARD_NOS_TUPLE_r33 860 -#define _GUARD_NOS_UNICODE_r02 861 -#define _GUARD_NOS_UNICODE_r12 862 -#define _GUARD_NOS_UNICODE_r22 863 -#define _GUARD_NOS_UNICODE_r33 864 -#define _GUARD_NOT_EXHAUSTED_LIST_r02 865 -#define _GUARD_NOT_EXHAUSTED_LIST_r12 866 -#define _GUARD_NOT_EXHAUSTED_LIST_r22 867 -#define _GUARD_NOT_EXHAUSTED_LIST_r33 868 -#define _GUARD_NOT_EXHAUSTED_RANGE_r02 869 -#define _GUARD_NOT_EXHAUSTED_RANGE_r12 870 -#define _GUARD_NOT_EXHAUSTED_RANGE_r22 871 -#define _GUARD_NOT_EXHAUSTED_RANGE_r33 872 -#define _GUARD_NOT_EXHAUSTED_TUPLE_r02 873 -#define _GUARD_NOT_EXHAUSTED_TUPLE_r12 874 -#define _GUARD_NOT_EXHAUSTED_TUPLE_r22 875 -#define _GUARD_NOT_EXHAUSTED_TUPLE_r33 876 -#define _GUARD_THIRD_NULL_r03 877 -#define _GUARD_THIRD_NULL_r13 878 -#define _GUARD_THIRD_NULL_r23 879 -#define _GUARD_THIRD_NULL_r33 880 -#define _GUARD_TOS_ANY_SET_r01 881 -#define _GUARD_TOS_ANY_SET_r11 882 -#define _GUARD_TOS_ANY_SET_r22 883 -#define _GUARD_TOS_ANY_SET_r33 884 -#define _GUARD_TOS_DICT_r01 885 -#define _GUARD_TOS_DICT_r11 886 -#define _GUARD_TOS_DICT_r22 887 -#define _GUARD_TOS_DICT_r33 888 -#define _GUARD_TOS_FLOAT_r01 889 -#define _GUARD_TOS_FLOAT_r11 890 -#define _GUARD_TOS_FLOAT_r22 891 -#define _GUARD_TOS_FLOAT_r33 892 -#define _GUARD_TOS_INT_r01 893 -#define _GUARD_TOS_INT_r11 894 -#define _GUARD_TOS_INT_r22 895 -#define _GUARD_TOS_INT_r33 896 -#define _GUARD_TOS_LIST_r01 897 -#define _GUARD_TOS_LIST_r11 898 -#define _GUARD_TOS_LIST_r22 899 -#define _GUARD_TOS_LIST_r33 900 -#define _GUARD_TOS_OVERFLOWED_r01 901 -#define _GUARD_TOS_OVERFLOWED_r11 902 -#define _GUARD_TOS_OVERFLOWED_r22 903 -#define _GUARD_TOS_OVERFLOWED_r33 904 -#define _GUARD_TOS_SLICE_r01 905 -#define _GUARD_TOS_SLICE_r11 906 -#define _GUARD_TOS_SLICE_r22 907 -#define _GUARD_TOS_SLICE_r33 908 -#define _GUARD_TOS_TUPLE_r01 909 -#define _GUARD_TOS_TUPLE_r11 910 -#define _GUARD_TOS_TUPLE_r22 911 -#define _GUARD_TOS_TUPLE_r33 912 -#define _GUARD_TOS_UNICODE_r01 913 -#define _GUARD_TOS_UNICODE_r11 914 -#define _GUARD_TOS_UNICODE_r22 915 -#define _GUARD_TOS_UNICODE_r33 916 -#define _GUARD_TYPE_VERSION_r01 917 -#define _GUARD_TYPE_VERSION_r11 918 -#define _GUARD_TYPE_VERSION_r22 919 -#define _GUARD_TYPE_VERSION_r33 920 -#define _GUARD_TYPE_VERSION_AND_LOCK_r01 921 -#define _GUARD_TYPE_VERSION_AND_LOCK_r11 922 -#define _GUARD_TYPE_VERSION_AND_LOCK_r22 923 -#define _GUARD_TYPE_VERSION_AND_LOCK_r33 924 -#define _HANDLE_PENDING_AND_DEOPT_r00 925 -#define _HANDLE_PENDING_AND_DEOPT_r10 926 -#define _HANDLE_PENDING_AND_DEOPT_r20 927 -#define _HANDLE_PENDING_AND_DEOPT_r30 928 -#define _IMPORT_FROM_r12 929 -#define _IMPORT_NAME_r21 930 -#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS_r00 931 -#define _INIT_CALL_PY_EXACT_ARGS_r01 932 -#define _INIT_CALL_PY_EXACT_ARGS_0_r01 933 -#define _INIT_CALL_PY_EXACT_ARGS_1_r01 934 -#define _INIT_CALL_PY_EXACT_ARGS_2_r01 935 -#define _INIT_CALL_PY_EXACT_ARGS_3_r01 936 -#define _INIT_CALL_PY_EXACT_ARGS_4_r01 937 -#define _INSERT_NULL_r10 938 -#define _INSTRUMENTED_FOR_ITER_r23 939 -#define _INSTRUMENTED_INSTRUCTION_r00 940 -#define _INSTRUMENTED_JUMP_FORWARD_r00 941 -#define _INSTRUMENTED_JUMP_FORWARD_r11 942 -#define _INSTRUMENTED_JUMP_FORWARD_r22 943 -#define _INSTRUMENTED_JUMP_FORWARD_r33 944 -#define _INSTRUMENTED_LINE_r00 945 -#define _INSTRUMENTED_NOT_TAKEN_r00 946 -#define _INSTRUMENTED_NOT_TAKEN_r11 947 -#define _INSTRUMENTED_NOT_TAKEN_r22 948 -#define _INSTRUMENTED_NOT_TAKEN_r33 949 -#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r00 950 -#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r10 951 -#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r21 952 -#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r32 953 -#define _INSTRUMENTED_POP_JUMP_IF_NONE_r10 954 -#define _INSTRUMENTED_POP_JUMP_IF_NOT_NONE_r10 955 -#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r00 956 -#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r10 957 -#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r21 958 -#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r32 959 -#define _IS_NONE_r11 960 -#define _IS_OP_r03 961 -#define _IS_OP_r13 962 -#define _IS_OP_r23 963 -#define _ITER_CHECK_LIST_r02 964 -#define _ITER_CHECK_LIST_r12 965 -#define _ITER_CHECK_LIST_r22 966 -#define _ITER_CHECK_LIST_r33 967 -#define _ITER_CHECK_RANGE_r02 968 -#define _ITER_CHECK_RANGE_r12 969 -#define _ITER_CHECK_RANGE_r22 970 -#define _ITER_CHECK_RANGE_r33 971 -#define _ITER_CHECK_TUPLE_r02 972 -#define _ITER_CHECK_TUPLE_r12 973 -#define _ITER_CHECK_TUPLE_r22 974 -#define _ITER_CHECK_TUPLE_r33 975 -#define _ITER_JUMP_LIST_r02 976 -#define _ITER_JUMP_LIST_r12 977 -#define _ITER_JUMP_LIST_r22 978 -#define _ITER_JUMP_LIST_r33 979 -#define _ITER_JUMP_RANGE_r02 980 -#define _ITER_JUMP_RANGE_r12 981 -#define _ITER_JUMP_RANGE_r22 982 -#define _ITER_JUMP_RANGE_r33 983 -#define _ITER_JUMP_TUPLE_r02 984 -#define _ITER_JUMP_TUPLE_r12 985 -#define _ITER_JUMP_TUPLE_r22 986 -#define _ITER_JUMP_TUPLE_r33 987 -#define _ITER_NEXT_LIST_r23 988 -#define _ITER_NEXT_LIST_TIER_TWO_r23 989 -#define _ITER_NEXT_RANGE_r03 990 -#define _ITER_NEXT_RANGE_r13 991 -#define _ITER_NEXT_RANGE_r23 992 -#define _ITER_NEXT_TUPLE_r03 993 -#define _ITER_NEXT_TUPLE_r13 994 -#define _ITER_NEXT_TUPLE_r23 995 -#define _JUMP_BACKWARD_NO_INTERRUPT_r00 996 -#define _JUMP_BACKWARD_NO_INTERRUPT_r11 997 -#define _JUMP_BACKWARD_NO_INTERRUPT_r22 998 -#define _JUMP_BACKWARD_NO_INTERRUPT_r33 999 -#define _JUMP_TO_TOP_r00 1000 -#define _LIST_APPEND_r10 1001 -#define _LIST_EXTEND_r10 1002 -#define _LOAD_ATTR_r10 1003 -#define _LOAD_ATTR_CLASS_r11 1004 -#define _LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN_r11 1005 -#define _LOAD_ATTR_INSTANCE_VALUE_r02 1006 -#define _LOAD_ATTR_INSTANCE_VALUE_r12 1007 -#define _LOAD_ATTR_INSTANCE_VALUE_r23 1008 -#define _LOAD_ATTR_METHOD_LAZY_DICT_r02 1009 -#define _LOAD_ATTR_METHOD_LAZY_DICT_r12 1010 -#define _LOAD_ATTR_METHOD_LAZY_DICT_r23 1011 -#define _LOAD_ATTR_METHOD_NO_DICT_r02 1012 -#define _LOAD_ATTR_METHOD_NO_DICT_r12 1013 -#define _LOAD_ATTR_METHOD_NO_DICT_r23 1014 -#define _LOAD_ATTR_METHOD_WITH_VALUES_r02 1015 -#define _LOAD_ATTR_METHOD_WITH_VALUES_r12 1016 -#define _LOAD_ATTR_METHOD_WITH_VALUES_r23 1017 -#define _LOAD_ATTR_MODULE_r11 1018 -#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT_r11 1019 -#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES_r11 1020 -#define _LOAD_ATTR_PROPERTY_FRAME_r11 1021 -#define _LOAD_ATTR_SLOT_r02 1022 -#define _LOAD_ATTR_SLOT_r12 1023 -#define _LOAD_ATTR_SLOT_r23 1024 -#define _LOAD_ATTR_WITH_HINT_r12 1025 -#define _LOAD_BUILD_CLASS_r01 1026 -#define _LOAD_BYTECODE_r00 1027 -#define _LOAD_COMMON_CONSTANT_r01 1028 -#define _LOAD_COMMON_CONSTANT_r12 1029 -#define _LOAD_COMMON_CONSTANT_r23 1030 -#define _LOAD_CONST_r01 1031 -#define _LOAD_CONST_r12 1032 -#define _LOAD_CONST_r23 1033 -#define _LOAD_CONST_INLINE_r01 1034 -#define _LOAD_CONST_INLINE_r12 1035 -#define _LOAD_CONST_INLINE_r23 1036 -#define _LOAD_CONST_INLINE_BORROW_r01 1037 -#define _LOAD_CONST_INLINE_BORROW_r12 1038 -#define _LOAD_CONST_INLINE_BORROW_r23 1039 -#define _LOAD_CONST_UNDER_INLINE_r02 1040 -#define _LOAD_CONST_UNDER_INLINE_r12 1041 -#define _LOAD_CONST_UNDER_INLINE_r23 1042 -#define _LOAD_CONST_UNDER_INLINE_BORROW_r02 1043 -#define _LOAD_CONST_UNDER_INLINE_BORROW_r12 1044 -#define _LOAD_CONST_UNDER_INLINE_BORROW_r23 1045 -#define _LOAD_DEREF_r01 1046 -#define _LOAD_FAST_r01 1047 -#define _LOAD_FAST_r12 1048 -#define _LOAD_FAST_r23 1049 -#define _LOAD_FAST_0_r01 1050 -#define _LOAD_FAST_0_r12 1051 -#define _LOAD_FAST_0_r23 1052 -#define _LOAD_FAST_1_r01 1053 -#define _LOAD_FAST_1_r12 1054 -#define _LOAD_FAST_1_r23 1055 -#define _LOAD_FAST_2_r01 1056 -#define _LOAD_FAST_2_r12 1057 -#define _LOAD_FAST_2_r23 1058 -#define _LOAD_FAST_3_r01 1059 -#define _LOAD_FAST_3_r12 1060 -#define _LOAD_FAST_3_r23 1061 -#define _LOAD_FAST_4_r01 1062 -#define _LOAD_FAST_4_r12 1063 -#define _LOAD_FAST_4_r23 1064 -#define _LOAD_FAST_5_r01 1065 -#define _LOAD_FAST_5_r12 1066 -#define _LOAD_FAST_5_r23 1067 -#define _LOAD_FAST_6_r01 1068 -#define _LOAD_FAST_6_r12 1069 -#define _LOAD_FAST_6_r23 1070 -#define _LOAD_FAST_7_r01 1071 -#define _LOAD_FAST_7_r12 1072 -#define _LOAD_FAST_7_r23 1073 -#define _LOAD_FAST_AND_CLEAR_r01 1074 -#define _LOAD_FAST_AND_CLEAR_r12 1075 -#define _LOAD_FAST_AND_CLEAR_r23 1076 -#define _LOAD_FAST_BORROW_r01 1077 -#define _LOAD_FAST_BORROW_r12 1078 -#define _LOAD_FAST_BORROW_r23 1079 -#define _LOAD_FAST_BORROW_0_r01 1080 -#define _LOAD_FAST_BORROW_0_r12 1081 -#define _LOAD_FAST_BORROW_0_r23 1082 -#define _LOAD_FAST_BORROW_1_r01 1083 -#define _LOAD_FAST_BORROW_1_r12 1084 -#define _LOAD_FAST_BORROW_1_r23 1085 -#define _LOAD_FAST_BORROW_2_r01 1086 -#define _LOAD_FAST_BORROW_2_r12 1087 -#define _LOAD_FAST_BORROW_2_r23 1088 -#define _LOAD_FAST_BORROW_3_r01 1089 -#define _LOAD_FAST_BORROW_3_r12 1090 -#define _LOAD_FAST_BORROW_3_r23 1091 -#define _LOAD_FAST_BORROW_4_r01 1092 -#define _LOAD_FAST_BORROW_4_r12 1093 -#define _LOAD_FAST_BORROW_4_r23 1094 -#define _LOAD_FAST_BORROW_5_r01 1095 -#define _LOAD_FAST_BORROW_5_r12 1096 -#define _LOAD_FAST_BORROW_5_r23 1097 -#define _LOAD_FAST_BORROW_6_r01 1098 -#define _LOAD_FAST_BORROW_6_r12 1099 -#define _LOAD_FAST_BORROW_6_r23 1100 -#define _LOAD_FAST_BORROW_7_r01 1101 -#define _LOAD_FAST_BORROW_7_r12 1102 -#define _LOAD_FAST_BORROW_7_r23 1103 -#define _LOAD_FAST_BORROW_LOAD_FAST_BORROW_r02 1104 -#define _LOAD_FAST_BORROW_LOAD_FAST_BORROW_r13 1105 -#define _LOAD_FAST_CHECK_r01 1106 -#define _LOAD_FAST_CHECK_r12 1107 -#define _LOAD_FAST_CHECK_r23 1108 -#define _LOAD_FAST_LOAD_FAST_r02 1109 -#define _LOAD_FAST_LOAD_FAST_r13 1110 -#define _LOAD_FROM_DICT_OR_DEREF_r11 1111 -#define _LOAD_FROM_DICT_OR_GLOBALS_r11 1112 -#define _LOAD_GLOBAL_r00 1113 -#define _LOAD_GLOBAL_BUILTINS_r01 1114 -#define _LOAD_GLOBAL_MODULE_r01 1115 -#define _LOAD_LOCALS_r01 1116 -#define _LOAD_LOCALS_r12 1117 -#define _LOAD_LOCALS_r23 1118 -#define _LOAD_NAME_r01 1119 -#define _LOAD_SMALL_INT_r01 1120 -#define _LOAD_SMALL_INT_r12 1121 -#define _LOAD_SMALL_INT_r23 1122 -#define _LOAD_SMALL_INT_0_r01 1123 -#define _LOAD_SMALL_INT_0_r12 1124 -#define _LOAD_SMALL_INT_0_r23 1125 -#define _LOAD_SMALL_INT_1_r01 1126 -#define _LOAD_SMALL_INT_1_r12 1127 -#define _LOAD_SMALL_INT_1_r23 1128 -#define _LOAD_SMALL_INT_2_r01 1129 -#define _LOAD_SMALL_INT_2_r12 1130 -#define _LOAD_SMALL_INT_2_r23 1131 -#define _LOAD_SMALL_INT_3_r01 1132 -#define _LOAD_SMALL_INT_3_r12 1133 -#define _LOAD_SMALL_INT_3_r23 1134 -#define _LOAD_SPECIAL_r00 1135 -#define _LOAD_SUPER_ATTR_ATTR_r31 1136 -#define _LOAD_SUPER_ATTR_METHOD_r32 1137 -#define _MAKE_CALLARGS_A_TUPLE_r33 1138 -#define _MAKE_CELL_r00 1139 -#define _MAKE_FUNCTION_r11 1140 -#define _MAKE_WARM_r00 1141 -#define _MAKE_WARM_r11 1142 -#define _MAKE_WARM_r22 1143 -#define _MAKE_WARM_r33 1144 -#define _MAP_ADD_r20 1145 -#define _MATCH_CLASS_r31 1146 -#define _MATCH_KEYS_r23 1147 -#define _MATCH_MAPPING_r02 1148 -#define _MATCH_MAPPING_r12 1149 -#define _MATCH_MAPPING_r23 1150 -#define _MATCH_SEQUENCE_r02 1151 -#define _MATCH_SEQUENCE_r12 1152 -#define _MATCH_SEQUENCE_r23 1153 -#define _MAYBE_EXPAND_METHOD_r00 1154 -#define _MAYBE_EXPAND_METHOD_KW_r11 1155 -#define _MONITOR_CALL_r00 1156 -#define _MONITOR_CALL_KW_r11 1157 -#define _MONITOR_JUMP_BACKWARD_r00 1158 -#define _MONITOR_JUMP_BACKWARD_r11 1159 -#define _MONITOR_JUMP_BACKWARD_r22 1160 -#define _MONITOR_JUMP_BACKWARD_r33 1161 -#define _MONITOR_RESUME_r00 1162 -#define _NOP_r00 1163 -#define _NOP_r11 1164 -#define _NOP_r22 1165 -#define _NOP_r33 1166 -#define _POP_CALL_r20 1167 -#define _POP_CALL_LOAD_CONST_INLINE_BORROW_r21 1168 -#define _POP_CALL_ONE_r30 1169 -#define _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW_r31 1170 -#define _POP_CALL_TWO_r30 1171 -#define _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW_r31 1172 -#define _POP_EXCEPT_r10 1173 -#define _POP_ITER_r20 1174 -#define _POP_JUMP_IF_FALSE_r00 1175 -#define _POP_JUMP_IF_FALSE_r10 1176 -#define _POP_JUMP_IF_FALSE_r21 1177 -#define _POP_JUMP_IF_FALSE_r32 1178 -#define _POP_JUMP_IF_TRUE_r00 1179 -#define _POP_JUMP_IF_TRUE_r10 1180 -#define _POP_JUMP_IF_TRUE_r21 1181 -#define _POP_JUMP_IF_TRUE_r32 1182 -#define _POP_TOP_r10 1183 -#define _POP_TOP_FLOAT_r00 1184 -#define _POP_TOP_FLOAT_r10 1185 -#define _POP_TOP_FLOAT_r21 1186 -#define _POP_TOP_FLOAT_r32 1187 -#define _POP_TOP_INT_r00 1188 -#define _POP_TOP_INT_r10 1189 -#define _POP_TOP_INT_r21 1190 -#define _POP_TOP_INT_r32 1191 -#define _POP_TOP_LOAD_CONST_INLINE_r11 1192 -#define _POP_TOP_LOAD_CONST_INLINE_BORROW_r11 1193 -#define _POP_TOP_NOP_r00 1194 -#define _POP_TOP_NOP_r10 1195 -#define _POP_TOP_NOP_r21 1196 -#define _POP_TOP_NOP_r32 1197 -#define _POP_TOP_UNICODE_r00 1198 -#define _POP_TOP_UNICODE_r10 1199 -#define _POP_TOP_UNICODE_r21 1200 -#define _POP_TOP_UNICODE_r32 1201 -#define _POP_TWO_r20 1202 -#define _POP_TWO_LOAD_CONST_INLINE_BORROW_r21 1203 -#define _PUSH_EXC_INFO_r02 1204 -#define _PUSH_EXC_INFO_r12 1205 -#define _PUSH_EXC_INFO_r23 1206 -#define _PUSH_FRAME_r10 1207 -#define _PUSH_NULL_r01 1208 -#define _PUSH_NULL_r12 1209 -#define _PUSH_NULL_r23 1210 -#define _PUSH_NULL_CONDITIONAL_r00 1211 -#define _PY_FRAME_GENERAL_r01 1212 -#define _PY_FRAME_KW_r11 1213 -#define _QUICKEN_RESUME_r00 1214 -#define _QUICKEN_RESUME_r11 1215 -#define _QUICKEN_RESUME_r22 1216 -#define _QUICKEN_RESUME_r33 1217 -#define _REPLACE_WITH_TRUE_r11 1218 -#define _RESUME_CHECK_r00 1219 -#define _RESUME_CHECK_r11 1220 -#define _RESUME_CHECK_r22 1221 -#define _RESUME_CHECK_r33 1222 -#define _RETURN_GENERATOR_r01 1223 -#define _RETURN_VALUE_r11 1224 -#define _SAVE_RETURN_OFFSET_r00 1225 -#define _SAVE_RETURN_OFFSET_r11 1226 -#define _SAVE_RETURN_OFFSET_r22 1227 -#define _SAVE_RETURN_OFFSET_r33 1228 -#define _SEND_r22 1229 -#define _SEND_GEN_FRAME_r22 1230 -#define _SETUP_ANNOTATIONS_r00 1231 -#define _SET_ADD_r10 1232 -#define _SET_FUNCTION_ATTRIBUTE_r01 1233 -#define _SET_FUNCTION_ATTRIBUTE_r11 1234 -#define _SET_FUNCTION_ATTRIBUTE_r21 1235 -#define _SET_FUNCTION_ATTRIBUTE_r32 1236 -#define _SET_IP_r00 1237 -#define _SET_IP_r11 1238 -#define _SET_IP_r22 1239 -#define _SET_IP_r33 1240 -#define _SET_UPDATE_r10 1241 -#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r02 1242 -#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r12 1243 -#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r22 1244 -#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r32 1245 -#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r03 1246 -#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r13 1247 -#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r23 1248 -#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r33 1249 -#define _SPILL_OR_RELOAD_r01 1250 -#define _SPILL_OR_RELOAD_r02 1251 -#define _SPILL_OR_RELOAD_r03 1252 -#define _SPILL_OR_RELOAD_r10 1253 -#define _SPILL_OR_RELOAD_r12 1254 -#define _SPILL_OR_RELOAD_r13 1255 -#define _SPILL_OR_RELOAD_r20 1256 -#define _SPILL_OR_RELOAD_r21 1257 -#define _SPILL_OR_RELOAD_r23 1258 -#define _SPILL_OR_RELOAD_r30 1259 -#define _SPILL_OR_RELOAD_r31 1260 -#define _SPILL_OR_RELOAD_r32 1261 -#define _START_EXECUTOR_r00 1262 -#define _STORE_ATTR_r20 1263 -#define _STORE_ATTR_INSTANCE_VALUE_r21 1264 -#define _STORE_ATTR_SLOT_r21 1265 -#define _STORE_ATTR_WITH_HINT_r21 1266 -#define _STORE_DEREF_r10 1267 -#define _STORE_FAST_LOAD_FAST_r11 1268 -#define _STORE_FAST_STORE_FAST_r20 1269 -#define _STORE_GLOBAL_r10 1270 -#define _STORE_NAME_r10 1271 -#define _STORE_SLICE_r30 1272 -#define _STORE_SUBSCR_r30 1273 -#define _STORE_SUBSCR_DICT_r31 1274 -#define _STORE_SUBSCR_LIST_INT_r32 1275 -#define _SWAP_r11 1276 -#define _SWAP_2_r02 1277 -#define _SWAP_2_r12 1278 -#define _SWAP_2_r22 1279 -#define _SWAP_2_r33 1280 -#define _SWAP_3_r03 1281 -#define _SWAP_3_r13 1282 -#define _SWAP_3_r23 1283 -#define _SWAP_3_r33 1284 -#define _SWAP_FAST_r01 1285 -#define _SWAP_FAST_r11 1286 -#define _SWAP_FAST_r22 1287 -#define _SWAP_FAST_r33 1288 -#define _SWAP_FAST_0_r01 1289 -#define _SWAP_FAST_0_r11 1290 -#define _SWAP_FAST_0_r22 1291 -#define _SWAP_FAST_0_r33 1292 -#define _SWAP_FAST_1_r01 1293 -#define _SWAP_FAST_1_r11 1294 -#define _SWAP_FAST_1_r22 1295 -#define _SWAP_FAST_1_r33 1296 -#define _SWAP_FAST_2_r01 1297 -#define _SWAP_FAST_2_r11 1298 -#define _SWAP_FAST_2_r22 1299 -#define _SWAP_FAST_2_r33 1300 -#define _SWAP_FAST_3_r01 1301 -#define _SWAP_FAST_3_r11 1302 -#define _SWAP_FAST_3_r22 1303 -#define _SWAP_FAST_3_r33 1304 -#define _SWAP_FAST_4_r01 1305 -#define _SWAP_FAST_4_r11 1306 -#define _SWAP_FAST_4_r22 1307 -#define _SWAP_FAST_4_r33 1308 -#define _SWAP_FAST_5_r01 1309 -#define _SWAP_FAST_5_r11 1310 -#define _SWAP_FAST_5_r22 1311 -#define _SWAP_FAST_5_r33 1312 -#define _SWAP_FAST_6_r01 1313 -#define _SWAP_FAST_6_r11 1314 -#define _SWAP_FAST_6_r22 1315 -#define _SWAP_FAST_6_r33 1316 -#define _SWAP_FAST_7_r01 1317 -#define _SWAP_FAST_7_r11 1318 -#define _SWAP_FAST_7_r22 1319 -#define _SWAP_FAST_7_r33 1320 -#define _TIER2_RESUME_CHECK_r00 1321 -#define _TIER2_RESUME_CHECK_r11 1322 -#define _TIER2_RESUME_CHECK_r22 1323 -#define _TIER2_RESUME_CHECK_r33 1324 -#define _TO_BOOL_r11 1325 -#define _TO_BOOL_BOOL_r01 1326 -#define _TO_BOOL_BOOL_r11 1327 -#define _TO_BOOL_BOOL_r22 1328 -#define _TO_BOOL_BOOL_r33 1329 -#define _TO_BOOL_INT_r11 1330 -#define _TO_BOOL_LIST_r11 1331 -#define _TO_BOOL_NONE_r01 1332 -#define _TO_BOOL_NONE_r11 1333 -#define _TO_BOOL_NONE_r22 1334 -#define _TO_BOOL_NONE_r33 1335 -#define _TO_BOOL_STR_r11 1336 -#define _TRACE_RECORD_r00 1337 -#define _UNARY_INVERT_r11 1338 -#define _UNARY_NEGATIVE_r11 1339 -#define _UNARY_NOT_r01 1340 -#define _UNARY_NOT_r11 1341 -#define _UNARY_NOT_r22 1342 -#define _UNARY_NOT_r33 1343 -#define _UNPACK_EX_r10 1344 -#define _UNPACK_SEQUENCE_r10 1345 -#define _UNPACK_SEQUENCE_LIST_r10 1346 -#define _UNPACK_SEQUENCE_TUPLE_r10 1347 -#define _UNPACK_SEQUENCE_TWO_TUPLE_r12 1348 -#define _WITH_EXCEPT_START_r33 1349 -#define _YIELD_VALUE_r11 1350 -#define MAX_UOP_REGS_ID 1350 +#define MAX_UOP_ID 560 +#define _BINARY_OP_r21 561 +#define _BINARY_OP_ADD_FLOAT_r03 562 +#define _BINARY_OP_ADD_FLOAT_r13 563 +#define _BINARY_OP_ADD_FLOAT_r23 564 +#define _BINARY_OP_ADD_INT_r03 565 +#define _BINARY_OP_ADD_INT_r13 566 +#define _BINARY_OP_ADD_INT_r23 567 +#define _BINARY_OP_ADD_UNICODE_r03 568 +#define _BINARY_OP_ADD_UNICODE_r13 569 +#define _BINARY_OP_ADD_UNICODE_r23 570 +#define _BINARY_OP_EXTEND_r21 571 +#define _BINARY_OP_INPLACE_ADD_UNICODE_r21 572 +#define _BINARY_OP_MULTIPLY_FLOAT_r03 573 +#define _BINARY_OP_MULTIPLY_FLOAT_r13 574 +#define _BINARY_OP_MULTIPLY_FLOAT_r23 575 +#define _BINARY_OP_MULTIPLY_INT_r03 576 +#define _BINARY_OP_MULTIPLY_INT_r13 577 +#define _BINARY_OP_MULTIPLY_INT_r23 578 +#define _BINARY_OP_SUBSCR_CHECK_FUNC_r23 579 +#define _BINARY_OP_SUBSCR_DICT_r21 580 +#define _BINARY_OP_SUBSCR_INIT_CALL_r01 581 +#define _BINARY_OP_SUBSCR_INIT_CALL_r11 582 +#define _BINARY_OP_SUBSCR_INIT_CALL_r21 583 +#define _BINARY_OP_SUBSCR_INIT_CALL_r31 584 +#define _BINARY_OP_SUBSCR_LIST_INT_r23 585 +#define _BINARY_OP_SUBSCR_LIST_SLICE_r21 586 +#define _BINARY_OP_SUBSCR_STR_INT_r23 587 +#define _BINARY_OP_SUBSCR_TUPLE_INT_r03 588 +#define _BINARY_OP_SUBSCR_TUPLE_INT_r13 589 +#define _BINARY_OP_SUBSCR_TUPLE_INT_r23 590 +#define _BINARY_OP_SUBSCR_USTR_INT_r23 591 +#define _BINARY_OP_SUBTRACT_FLOAT_r03 592 +#define _BINARY_OP_SUBTRACT_FLOAT_r13 593 +#define _BINARY_OP_SUBTRACT_FLOAT_r23 594 +#define _BINARY_OP_SUBTRACT_INT_r03 595 +#define _BINARY_OP_SUBTRACT_INT_r13 596 +#define _BINARY_OP_SUBTRACT_INT_r23 597 +#define _BINARY_SLICE_r31 598 +#define _BUILD_INTERPOLATION_r01 599 +#define _BUILD_LIST_r01 600 +#define _BUILD_MAP_r01 601 +#define _BUILD_SET_r01 602 +#define _BUILD_SLICE_r01 603 +#define _BUILD_STRING_r01 604 +#define _BUILD_TEMPLATE_r21 605 +#define _BUILD_TUPLE_r01 606 +#define _CALL_BUILTIN_CLASS_r01 607 +#define _CALL_BUILTIN_FAST_r01 608 +#define _CALL_BUILTIN_FAST_WITH_KEYWORDS_r01 609 +#define _CALL_BUILTIN_O_r03 610 +#define _CALL_INTRINSIC_1_r11 611 +#define _CALL_INTRINSIC_2_r21 612 +#define _CALL_ISINSTANCE_r31 613 +#define _CALL_KW_NON_PY_r11 614 +#define _CALL_LEN_r33 615 +#define _CALL_LIST_APPEND_r03 616 +#define _CALL_LIST_APPEND_r13 617 +#define _CALL_LIST_APPEND_r23 618 +#define _CALL_LIST_APPEND_r33 619 +#define _CALL_METHOD_DESCRIPTOR_FAST_r01 620 +#define _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_r01 621 +#define _CALL_METHOD_DESCRIPTOR_NOARGS_r01 622 +#define _CALL_METHOD_DESCRIPTOR_O_r03 623 +#define _CALL_NON_PY_GENERAL_r01 624 +#define _CALL_STR_1_r32 625 +#define _CALL_TUPLE_1_r32 626 +#define _CALL_TYPE_1_r02 627 +#define _CALL_TYPE_1_r12 628 +#define _CALL_TYPE_1_r22 629 +#define _CALL_TYPE_1_r32 630 +#define _CHECK_AND_ALLOCATE_OBJECT_r00 631 +#define _CHECK_ATTR_CLASS_r01 632 +#define _CHECK_ATTR_CLASS_r11 633 +#define _CHECK_ATTR_CLASS_r22 634 +#define _CHECK_ATTR_CLASS_r33 635 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r01 636 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r11 637 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r22 638 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r33 639 +#define _CHECK_CALL_BOUND_METHOD_EXACT_ARGS_r00 640 +#define _CHECK_EG_MATCH_r22 641 +#define _CHECK_EXC_MATCH_r22 642 +#define _CHECK_FUNCTION_EXACT_ARGS_r00 643 +#define _CHECK_FUNCTION_VERSION_r00 644 +#define _CHECK_FUNCTION_VERSION_INLINE_r00 645 +#define _CHECK_FUNCTION_VERSION_INLINE_r11 646 +#define _CHECK_FUNCTION_VERSION_INLINE_r22 647 +#define _CHECK_FUNCTION_VERSION_INLINE_r33 648 +#define _CHECK_FUNCTION_VERSION_KW_r11 649 +#define _CHECK_IS_NOT_PY_CALLABLE_r00 650 +#define _CHECK_IS_NOT_PY_CALLABLE_KW_r11 651 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r01 652 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r11 653 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r22 654 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r33 655 +#define _CHECK_METHOD_VERSION_r00 656 +#define _CHECK_METHOD_VERSION_KW_r11 657 +#define _CHECK_PEP_523_r00 658 +#define _CHECK_PEP_523_r11 659 +#define _CHECK_PEP_523_r22 660 +#define _CHECK_PEP_523_r33 661 +#define _CHECK_PERIODIC_r00 662 +#define _CHECK_PERIODIC_AT_END_r00 663 +#define _CHECK_PERIODIC_IF_NOT_YIELD_FROM_r00 664 +#define _CHECK_RECURSION_REMAINING_r00 665 +#define _CHECK_RECURSION_REMAINING_r11 666 +#define _CHECK_RECURSION_REMAINING_r22 667 +#define _CHECK_RECURSION_REMAINING_r33 668 +#define _CHECK_STACK_SPACE_r00 669 +#define _CHECK_STACK_SPACE_OPERAND_r00 670 +#define _CHECK_STACK_SPACE_OPERAND_r11 671 +#define _CHECK_STACK_SPACE_OPERAND_r22 672 +#define _CHECK_STACK_SPACE_OPERAND_r33 673 +#define _CHECK_VALIDITY_r00 674 +#define _CHECK_VALIDITY_r11 675 +#define _CHECK_VALIDITY_r22 676 +#define _CHECK_VALIDITY_r33 677 +#define _COLD_DYNAMIC_EXIT_r00 678 +#define _COLD_EXIT_r00 679 +#define _COMPARE_OP_r21 680 +#define _COMPARE_OP_FLOAT_r03 681 +#define _COMPARE_OP_FLOAT_r13 682 +#define _COMPARE_OP_FLOAT_r23 683 +#define _COMPARE_OP_INT_r23 684 +#define _COMPARE_OP_STR_r23 685 +#define _CONTAINS_OP_r21 686 +#define _CONTAINS_OP_DICT_r21 687 +#define _CONTAINS_OP_SET_r21 688 +#define _CONVERT_VALUE_r11 689 +#define _COPY_r01 690 +#define _COPY_1_r02 691 +#define _COPY_1_r12 692 +#define _COPY_1_r23 693 +#define _COPY_2_r03 694 +#define _COPY_2_r13 695 +#define _COPY_2_r23 696 +#define _COPY_3_r03 697 +#define _COPY_3_r13 698 +#define _COPY_3_r23 699 +#define _COPY_3_r33 700 +#define _COPY_FREE_VARS_r00 701 +#define _COPY_FREE_VARS_r11 702 +#define _COPY_FREE_VARS_r22 703 +#define _COPY_FREE_VARS_r33 704 +#define _CREATE_INIT_FRAME_r01 705 +#define _DELETE_ATTR_r10 706 +#define _DELETE_DEREF_r00 707 +#define _DELETE_FAST_r00 708 +#define _DELETE_GLOBAL_r00 709 +#define _DELETE_NAME_r00 710 +#define _DELETE_SUBSCR_r20 711 +#define _DEOPT_r00 712 +#define _DEOPT_r10 713 +#define _DEOPT_r20 714 +#define _DEOPT_r30 715 +#define _DICT_MERGE_r10 716 +#define _DICT_UPDATE_r10 717 +#define _DO_CALL_r01 718 +#define _DO_CALL_FUNCTION_EX_r31 719 +#define _DO_CALL_KW_r11 720 +#define _DYNAMIC_EXIT_r00 721 +#define _DYNAMIC_EXIT_r10 722 +#define _DYNAMIC_EXIT_r20 723 +#define _DYNAMIC_EXIT_r30 724 +#define _END_FOR_r10 725 +#define _END_SEND_r21 726 +#define _ERROR_POP_N_r00 727 +#define _EXIT_INIT_CHECK_r10 728 +#define _EXIT_TRACE_r00 729 +#define _EXIT_TRACE_r10 730 +#define _EXIT_TRACE_r20 731 +#define _EXIT_TRACE_r30 732 +#define _EXPAND_METHOD_r00 733 +#define _EXPAND_METHOD_KW_r11 734 +#define _FATAL_ERROR_r00 735 +#define _FATAL_ERROR_r11 736 +#define _FATAL_ERROR_r22 737 +#define _FATAL_ERROR_r33 738 +#define _FORMAT_SIMPLE_r11 739 +#define _FORMAT_WITH_SPEC_r21 740 +#define _FOR_ITER_r23 741 +#define _FOR_ITER_GEN_FRAME_r03 742 +#define _FOR_ITER_GEN_FRAME_r13 743 +#define _FOR_ITER_GEN_FRAME_r23 744 +#define _FOR_ITER_TIER_TWO_r23 745 +#define _GET_AITER_r11 746 +#define _GET_ANEXT_r12 747 +#define _GET_AWAITABLE_r11 748 +#define _GET_ITER_r12 749 +#define _GET_LEN_r12 750 +#define _GET_YIELD_FROM_ITER_r11 751 +#define _GUARD_BINARY_OP_EXTEND_r22 752 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r02 753 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r12 754 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r22 755 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r33 756 +#define _GUARD_CALLABLE_ISINSTANCE_r03 757 +#define _GUARD_CALLABLE_ISINSTANCE_r13 758 +#define _GUARD_CALLABLE_ISINSTANCE_r23 759 +#define _GUARD_CALLABLE_ISINSTANCE_r33 760 +#define _GUARD_CALLABLE_LEN_r03 761 +#define _GUARD_CALLABLE_LEN_r13 762 +#define _GUARD_CALLABLE_LEN_r23 763 +#define _GUARD_CALLABLE_LEN_r33 764 +#define _GUARD_CALLABLE_LIST_APPEND_r03 765 +#define _GUARD_CALLABLE_LIST_APPEND_r13 766 +#define _GUARD_CALLABLE_LIST_APPEND_r23 767 +#define _GUARD_CALLABLE_LIST_APPEND_r33 768 +#define _GUARD_CALLABLE_STR_1_r03 769 +#define _GUARD_CALLABLE_STR_1_r13 770 +#define _GUARD_CALLABLE_STR_1_r23 771 +#define _GUARD_CALLABLE_STR_1_r33 772 +#define _GUARD_CALLABLE_TUPLE_1_r03 773 +#define _GUARD_CALLABLE_TUPLE_1_r13 774 +#define _GUARD_CALLABLE_TUPLE_1_r23 775 +#define _GUARD_CALLABLE_TUPLE_1_r33 776 +#define _GUARD_CALLABLE_TYPE_1_r03 777 +#define _GUARD_CALLABLE_TYPE_1_r13 778 +#define _GUARD_CALLABLE_TYPE_1_r23 779 +#define _GUARD_CALLABLE_TYPE_1_r33 780 +#define _GUARD_DORV_NO_DICT_r01 781 +#define _GUARD_DORV_NO_DICT_r11 782 +#define _GUARD_DORV_NO_DICT_r22 783 +#define _GUARD_DORV_NO_DICT_r33 784 +#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r01 785 +#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r11 786 +#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r22 787 +#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT_r33 788 +#define _GUARD_GLOBALS_VERSION_r00 789 +#define _GUARD_GLOBALS_VERSION_r11 790 +#define _GUARD_GLOBALS_VERSION_r22 791 +#define _GUARD_GLOBALS_VERSION_r33 792 +#define _GUARD_IP_RETURN_GENERATOR_r00 793 +#define _GUARD_IP_RETURN_GENERATOR_r11 794 +#define _GUARD_IP_RETURN_GENERATOR_r22 795 +#define _GUARD_IP_RETURN_GENERATOR_r33 796 +#define _GUARD_IP_RETURN_VALUE_r00 797 +#define _GUARD_IP_RETURN_VALUE_r11 798 +#define _GUARD_IP_RETURN_VALUE_r22 799 +#define _GUARD_IP_RETURN_VALUE_r33 800 +#define _GUARD_IP_YIELD_VALUE_r00 801 +#define _GUARD_IP_YIELD_VALUE_r11 802 +#define _GUARD_IP_YIELD_VALUE_r22 803 +#define _GUARD_IP_YIELD_VALUE_r33 804 +#define _GUARD_IP__PUSH_FRAME_r00 805 +#define _GUARD_IP__PUSH_FRAME_r11 806 +#define _GUARD_IP__PUSH_FRAME_r22 807 +#define _GUARD_IP__PUSH_FRAME_r33 808 +#define _GUARD_IS_FALSE_POP_r00 809 +#define _GUARD_IS_FALSE_POP_r10 810 +#define _GUARD_IS_FALSE_POP_r21 811 +#define _GUARD_IS_FALSE_POP_r32 812 +#define _GUARD_IS_NONE_POP_r00 813 +#define _GUARD_IS_NONE_POP_r10 814 +#define _GUARD_IS_NONE_POP_r21 815 +#define _GUARD_IS_NONE_POP_r32 816 +#define _GUARD_IS_NOT_NONE_POP_r10 817 +#define _GUARD_IS_TRUE_POP_r00 818 +#define _GUARD_IS_TRUE_POP_r10 819 +#define _GUARD_IS_TRUE_POP_r21 820 +#define _GUARD_IS_TRUE_POP_r32 821 +#define _GUARD_KEYS_VERSION_r01 822 +#define _GUARD_KEYS_VERSION_r11 823 +#define _GUARD_KEYS_VERSION_r22 824 +#define _GUARD_KEYS_VERSION_r33 825 +#define _GUARD_NOS_COMPACT_ASCII_r02 826 +#define _GUARD_NOS_COMPACT_ASCII_r12 827 +#define _GUARD_NOS_COMPACT_ASCII_r22 828 +#define _GUARD_NOS_COMPACT_ASCII_r33 829 +#define _GUARD_NOS_DICT_r02 830 +#define _GUARD_NOS_DICT_r12 831 +#define _GUARD_NOS_DICT_r22 832 +#define _GUARD_NOS_DICT_r33 833 +#define _GUARD_NOS_FLOAT_r02 834 +#define _GUARD_NOS_FLOAT_r12 835 +#define _GUARD_NOS_FLOAT_r22 836 +#define _GUARD_NOS_FLOAT_r33 837 +#define _GUARD_NOS_INT_r02 838 +#define _GUARD_NOS_INT_r12 839 +#define _GUARD_NOS_INT_r22 840 +#define _GUARD_NOS_INT_r33 841 +#define _GUARD_NOS_LIST_r02 842 +#define _GUARD_NOS_LIST_r12 843 +#define _GUARD_NOS_LIST_r22 844 +#define _GUARD_NOS_LIST_r33 845 +#define _GUARD_NOS_NOT_NULL_r02 846 +#define _GUARD_NOS_NOT_NULL_r12 847 +#define _GUARD_NOS_NOT_NULL_r22 848 +#define _GUARD_NOS_NOT_NULL_r33 849 +#define _GUARD_NOS_NULL_r02 850 +#define _GUARD_NOS_NULL_r12 851 +#define _GUARD_NOS_NULL_r22 852 +#define _GUARD_NOS_NULL_r33 853 +#define _GUARD_NOS_OVERFLOWED_r02 854 +#define _GUARD_NOS_OVERFLOWED_r12 855 +#define _GUARD_NOS_OVERFLOWED_r22 856 +#define _GUARD_NOS_OVERFLOWED_r33 857 +#define _GUARD_NOS_TUPLE_r02 858 +#define _GUARD_NOS_TUPLE_r12 859 +#define _GUARD_NOS_TUPLE_r22 860 +#define _GUARD_NOS_TUPLE_r33 861 +#define _GUARD_NOS_UNICODE_r02 862 +#define _GUARD_NOS_UNICODE_r12 863 +#define _GUARD_NOS_UNICODE_r22 864 +#define _GUARD_NOS_UNICODE_r33 865 +#define _GUARD_NOT_EXHAUSTED_LIST_r02 866 +#define _GUARD_NOT_EXHAUSTED_LIST_r12 867 +#define _GUARD_NOT_EXHAUSTED_LIST_r22 868 +#define _GUARD_NOT_EXHAUSTED_LIST_r33 869 +#define _GUARD_NOT_EXHAUSTED_RANGE_r02 870 +#define _GUARD_NOT_EXHAUSTED_RANGE_r12 871 +#define _GUARD_NOT_EXHAUSTED_RANGE_r22 872 +#define _GUARD_NOT_EXHAUSTED_RANGE_r33 873 +#define _GUARD_NOT_EXHAUSTED_TUPLE_r02 874 +#define _GUARD_NOT_EXHAUSTED_TUPLE_r12 875 +#define _GUARD_NOT_EXHAUSTED_TUPLE_r22 876 +#define _GUARD_NOT_EXHAUSTED_TUPLE_r33 877 +#define _GUARD_THIRD_NULL_r03 878 +#define _GUARD_THIRD_NULL_r13 879 +#define _GUARD_THIRD_NULL_r23 880 +#define _GUARD_THIRD_NULL_r33 881 +#define _GUARD_TOS_ANY_SET_r01 882 +#define _GUARD_TOS_ANY_SET_r11 883 +#define _GUARD_TOS_ANY_SET_r22 884 +#define _GUARD_TOS_ANY_SET_r33 885 +#define _GUARD_TOS_DICT_r01 886 +#define _GUARD_TOS_DICT_r11 887 +#define _GUARD_TOS_DICT_r22 888 +#define _GUARD_TOS_DICT_r33 889 +#define _GUARD_TOS_FLOAT_r01 890 +#define _GUARD_TOS_FLOAT_r11 891 +#define _GUARD_TOS_FLOAT_r22 892 +#define _GUARD_TOS_FLOAT_r33 893 +#define _GUARD_TOS_INT_r01 894 +#define _GUARD_TOS_INT_r11 895 +#define _GUARD_TOS_INT_r22 896 +#define _GUARD_TOS_INT_r33 897 +#define _GUARD_TOS_LIST_r01 898 +#define _GUARD_TOS_LIST_r11 899 +#define _GUARD_TOS_LIST_r22 900 +#define _GUARD_TOS_LIST_r33 901 +#define _GUARD_TOS_OVERFLOWED_r01 902 +#define _GUARD_TOS_OVERFLOWED_r11 903 +#define _GUARD_TOS_OVERFLOWED_r22 904 +#define _GUARD_TOS_OVERFLOWED_r33 905 +#define _GUARD_TOS_SLICE_r01 906 +#define _GUARD_TOS_SLICE_r11 907 +#define _GUARD_TOS_SLICE_r22 908 +#define _GUARD_TOS_SLICE_r33 909 +#define _GUARD_TOS_TUPLE_r01 910 +#define _GUARD_TOS_TUPLE_r11 911 +#define _GUARD_TOS_TUPLE_r22 912 +#define _GUARD_TOS_TUPLE_r33 913 +#define _GUARD_TOS_UNICODE_r01 914 +#define _GUARD_TOS_UNICODE_r11 915 +#define _GUARD_TOS_UNICODE_r22 916 +#define _GUARD_TOS_UNICODE_r33 917 +#define _GUARD_TYPE_VERSION_r01 918 +#define _GUARD_TYPE_VERSION_r11 919 +#define _GUARD_TYPE_VERSION_r22 920 +#define _GUARD_TYPE_VERSION_r33 921 +#define _GUARD_TYPE_VERSION_AND_LOCK_r01 922 +#define _GUARD_TYPE_VERSION_AND_LOCK_r11 923 +#define _GUARD_TYPE_VERSION_AND_LOCK_r22 924 +#define _GUARD_TYPE_VERSION_AND_LOCK_r33 925 +#define _HANDLE_PENDING_AND_DEOPT_r00 926 +#define _HANDLE_PENDING_AND_DEOPT_r10 927 +#define _HANDLE_PENDING_AND_DEOPT_r20 928 +#define _HANDLE_PENDING_AND_DEOPT_r30 929 +#define _IMPORT_FROM_r12 930 +#define _IMPORT_NAME_r21 931 +#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS_r00 932 +#define _INIT_CALL_PY_EXACT_ARGS_r01 933 +#define _INIT_CALL_PY_EXACT_ARGS_0_r01 934 +#define _INIT_CALL_PY_EXACT_ARGS_1_r01 935 +#define _INIT_CALL_PY_EXACT_ARGS_2_r01 936 +#define _INIT_CALL_PY_EXACT_ARGS_3_r01 937 +#define _INIT_CALL_PY_EXACT_ARGS_4_r01 938 +#define _INSERT_1_LOAD_CONST_INLINE_BORROW_r02 939 +#define _INSERT_1_LOAD_CONST_INLINE_BORROW_r12 940 +#define _INSERT_1_LOAD_CONST_INLINE_BORROW_r23 941 +#define _INSERT_NULL_r10 942 +#define _INSTRUMENTED_FOR_ITER_r23 943 +#define _INSTRUMENTED_INSTRUCTION_r00 944 +#define _INSTRUMENTED_JUMP_FORWARD_r00 945 +#define _INSTRUMENTED_JUMP_FORWARD_r11 946 +#define _INSTRUMENTED_JUMP_FORWARD_r22 947 +#define _INSTRUMENTED_JUMP_FORWARD_r33 948 +#define _INSTRUMENTED_LINE_r00 949 +#define _INSTRUMENTED_NOT_TAKEN_r00 950 +#define _INSTRUMENTED_NOT_TAKEN_r11 951 +#define _INSTRUMENTED_NOT_TAKEN_r22 952 +#define _INSTRUMENTED_NOT_TAKEN_r33 953 +#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r00 954 +#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r10 955 +#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r21 956 +#define _INSTRUMENTED_POP_JUMP_IF_FALSE_r32 957 +#define _INSTRUMENTED_POP_JUMP_IF_NONE_r10 958 +#define _INSTRUMENTED_POP_JUMP_IF_NOT_NONE_r10 959 +#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r00 960 +#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r10 961 +#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r21 962 +#define _INSTRUMENTED_POP_JUMP_IF_TRUE_r32 963 +#define _IS_NONE_r11 964 +#define _IS_OP_r03 965 +#define _IS_OP_r13 966 +#define _IS_OP_r23 967 +#define _ITER_CHECK_LIST_r02 968 +#define _ITER_CHECK_LIST_r12 969 +#define _ITER_CHECK_LIST_r22 970 +#define _ITER_CHECK_LIST_r33 971 +#define _ITER_CHECK_RANGE_r02 972 +#define _ITER_CHECK_RANGE_r12 973 +#define _ITER_CHECK_RANGE_r22 974 +#define _ITER_CHECK_RANGE_r33 975 +#define _ITER_CHECK_TUPLE_r02 976 +#define _ITER_CHECK_TUPLE_r12 977 +#define _ITER_CHECK_TUPLE_r22 978 +#define _ITER_CHECK_TUPLE_r33 979 +#define _ITER_JUMP_LIST_r02 980 +#define _ITER_JUMP_LIST_r12 981 +#define _ITER_JUMP_LIST_r22 982 +#define _ITER_JUMP_LIST_r33 983 +#define _ITER_JUMP_RANGE_r02 984 +#define _ITER_JUMP_RANGE_r12 985 +#define _ITER_JUMP_RANGE_r22 986 +#define _ITER_JUMP_RANGE_r33 987 +#define _ITER_JUMP_TUPLE_r02 988 +#define _ITER_JUMP_TUPLE_r12 989 +#define _ITER_JUMP_TUPLE_r22 990 +#define _ITER_JUMP_TUPLE_r33 991 +#define _ITER_NEXT_LIST_r23 992 +#define _ITER_NEXT_LIST_TIER_TWO_r23 993 +#define _ITER_NEXT_RANGE_r03 994 +#define _ITER_NEXT_RANGE_r13 995 +#define _ITER_NEXT_RANGE_r23 996 +#define _ITER_NEXT_TUPLE_r03 997 +#define _ITER_NEXT_TUPLE_r13 998 +#define _ITER_NEXT_TUPLE_r23 999 +#define _JUMP_BACKWARD_NO_INTERRUPT_r00 1000 +#define _JUMP_BACKWARD_NO_INTERRUPT_r11 1001 +#define _JUMP_BACKWARD_NO_INTERRUPT_r22 1002 +#define _JUMP_BACKWARD_NO_INTERRUPT_r33 1003 +#define _JUMP_TO_TOP_r00 1004 +#define _LIST_APPEND_r10 1005 +#define _LIST_EXTEND_r10 1006 +#define _LOAD_ATTR_r10 1007 +#define _LOAD_ATTR_CLASS_r11 1008 +#define _LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN_r11 1009 +#define _LOAD_ATTR_INSTANCE_VALUE_r02 1010 +#define _LOAD_ATTR_INSTANCE_VALUE_r12 1011 +#define _LOAD_ATTR_INSTANCE_VALUE_r23 1012 +#define _LOAD_ATTR_METHOD_LAZY_DICT_r02 1013 +#define _LOAD_ATTR_METHOD_LAZY_DICT_r12 1014 +#define _LOAD_ATTR_METHOD_LAZY_DICT_r23 1015 +#define _LOAD_ATTR_METHOD_NO_DICT_r02 1016 +#define _LOAD_ATTR_METHOD_NO_DICT_r12 1017 +#define _LOAD_ATTR_METHOD_NO_DICT_r23 1018 +#define _LOAD_ATTR_METHOD_WITH_VALUES_r02 1019 +#define _LOAD_ATTR_METHOD_WITH_VALUES_r12 1020 +#define _LOAD_ATTR_METHOD_WITH_VALUES_r23 1021 +#define _LOAD_ATTR_MODULE_r11 1022 +#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT_r11 1023 +#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES_r11 1024 +#define _LOAD_ATTR_PROPERTY_FRAME_r11 1025 +#define _LOAD_ATTR_SLOT_r02 1026 +#define _LOAD_ATTR_SLOT_r12 1027 +#define _LOAD_ATTR_SLOT_r23 1028 +#define _LOAD_ATTR_WITH_HINT_r12 1029 +#define _LOAD_BUILD_CLASS_r01 1030 +#define _LOAD_BYTECODE_r00 1031 +#define _LOAD_COMMON_CONSTANT_r01 1032 +#define _LOAD_COMMON_CONSTANT_r12 1033 +#define _LOAD_COMMON_CONSTANT_r23 1034 +#define _LOAD_CONST_r01 1035 +#define _LOAD_CONST_r12 1036 +#define _LOAD_CONST_r23 1037 +#define _LOAD_CONST_INLINE_r01 1038 +#define _LOAD_CONST_INLINE_r12 1039 +#define _LOAD_CONST_INLINE_r23 1040 +#define _LOAD_CONST_INLINE_BORROW_r01 1041 +#define _LOAD_CONST_INLINE_BORROW_r12 1042 +#define _LOAD_CONST_INLINE_BORROW_r23 1043 +#define _LOAD_CONST_UNDER_INLINE_r02 1044 +#define _LOAD_CONST_UNDER_INLINE_r12 1045 +#define _LOAD_CONST_UNDER_INLINE_r23 1046 +#define _LOAD_CONST_UNDER_INLINE_BORROW_r02 1047 +#define _LOAD_CONST_UNDER_INLINE_BORROW_r12 1048 +#define _LOAD_CONST_UNDER_INLINE_BORROW_r23 1049 +#define _LOAD_DEREF_r01 1050 +#define _LOAD_FAST_r01 1051 +#define _LOAD_FAST_r12 1052 +#define _LOAD_FAST_r23 1053 +#define _LOAD_FAST_0_r01 1054 +#define _LOAD_FAST_0_r12 1055 +#define _LOAD_FAST_0_r23 1056 +#define _LOAD_FAST_1_r01 1057 +#define _LOAD_FAST_1_r12 1058 +#define _LOAD_FAST_1_r23 1059 +#define _LOAD_FAST_2_r01 1060 +#define _LOAD_FAST_2_r12 1061 +#define _LOAD_FAST_2_r23 1062 +#define _LOAD_FAST_3_r01 1063 +#define _LOAD_FAST_3_r12 1064 +#define _LOAD_FAST_3_r23 1065 +#define _LOAD_FAST_4_r01 1066 +#define _LOAD_FAST_4_r12 1067 +#define _LOAD_FAST_4_r23 1068 +#define _LOAD_FAST_5_r01 1069 +#define _LOAD_FAST_5_r12 1070 +#define _LOAD_FAST_5_r23 1071 +#define _LOAD_FAST_6_r01 1072 +#define _LOAD_FAST_6_r12 1073 +#define _LOAD_FAST_6_r23 1074 +#define _LOAD_FAST_7_r01 1075 +#define _LOAD_FAST_7_r12 1076 +#define _LOAD_FAST_7_r23 1077 +#define _LOAD_FAST_AND_CLEAR_r01 1078 +#define _LOAD_FAST_AND_CLEAR_r12 1079 +#define _LOAD_FAST_AND_CLEAR_r23 1080 +#define _LOAD_FAST_BORROW_r01 1081 +#define _LOAD_FAST_BORROW_r12 1082 +#define _LOAD_FAST_BORROW_r23 1083 +#define _LOAD_FAST_BORROW_0_r01 1084 +#define _LOAD_FAST_BORROW_0_r12 1085 +#define _LOAD_FAST_BORROW_0_r23 1086 +#define _LOAD_FAST_BORROW_1_r01 1087 +#define _LOAD_FAST_BORROW_1_r12 1088 +#define _LOAD_FAST_BORROW_1_r23 1089 +#define _LOAD_FAST_BORROW_2_r01 1090 +#define _LOAD_FAST_BORROW_2_r12 1091 +#define _LOAD_FAST_BORROW_2_r23 1092 +#define _LOAD_FAST_BORROW_3_r01 1093 +#define _LOAD_FAST_BORROW_3_r12 1094 +#define _LOAD_FAST_BORROW_3_r23 1095 +#define _LOAD_FAST_BORROW_4_r01 1096 +#define _LOAD_FAST_BORROW_4_r12 1097 +#define _LOAD_FAST_BORROW_4_r23 1098 +#define _LOAD_FAST_BORROW_5_r01 1099 +#define _LOAD_FAST_BORROW_5_r12 1100 +#define _LOAD_FAST_BORROW_5_r23 1101 +#define _LOAD_FAST_BORROW_6_r01 1102 +#define _LOAD_FAST_BORROW_6_r12 1103 +#define _LOAD_FAST_BORROW_6_r23 1104 +#define _LOAD_FAST_BORROW_7_r01 1105 +#define _LOAD_FAST_BORROW_7_r12 1106 +#define _LOAD_FAST_BORROW_7_r23 1107 +#define _LOAD_FAST_BORROW_LOAD_FAST_BORROW_r02 1108 +#define _LOAD_FAST_BORROW_LOAD_FAST_BORROW_r13 1109 +#define _LOAD_FAST_CHECK_r01 1110 +#define _LOAD_FAST_CHECK_r12 1111 +#define _LOAD_FAST_CHECK_r23 1112 +#define _LOAD_FAST_LOAD_FAST_r02 1113 +#define _LOAD_FAST_LOAD_FAST_r13 1114 +#define _LOAD_FROM_DICT_OR_DEREF_r11 1115 +#define _LOAD_FROM_DICT_OR_GLOBALS_r11 1116 +#define _LOAD_GLOBAL_r00 1117 +#define _LOAD_GLOBAL_BUILTINS_r01 1118 +#define _LOAD_GLOBAL_MODULE_r01 1119 +#define _LOAD_LOCALS_r01 1120 +#define _LOAD_LOCALS_r12 1121 +#define _LOAD_LOCALS_r23 1122 +#define _LOAD_NAME_r01 1123 +#define _LOAD_SMALL_INT_r01 1124 +#define _LOAD_SMALL_INT_r12 1125 +#define _LOAD_SMALL_INT_r23 1126 +#define _LOAD_SMALL_INT_0_r01 1127 +#define _LOAD_SMALL_INT_0_r12 1128 +#define _LOAD_SMALL_INT_0_r23 1129 +#define _LOAD_SMALL_INT_1_r01 1130 +#define _LOAD_SMALL_INT_1_r12 1131 +#define _LOAD_SMALL_INT_1_r23 1132 +#define _LOAD_SMALL_INT_2_r01 1133 +#define _LOAD_SMALL_INT_2_r12 1134 +#define _LOAD_SMALL_INT_2_r23 1135 +#define _LOAD_SMALL_INT_3_r01 1136 +#define _LOAD_SMALL_INT_3_r12 1137 +#define _LOAD_SMALL_INT_3_r23 1138 +#define _LOAD_SPECIAL_r00 1139 +#define _LOAD_SUPER_ATTR_ATTR_r31 1140 +#define _LOAD_SUPER_ATTR_METHOD_r32 1141 +#define _MAKE_CALLARGS_A_TUPLE_r33 1142 +#define _MAKE_CELL_r00 1143 +#define _MAKE_FUNCTION_r11 1144 +#define _MAKE_WARM_r00 1145 +#define _MAKE_WARM_r11 1146 +#define _MAKE_WARM_r22 1147 +#define _MAKE_WARM_r33 1148 +#define _MAP_ADD_r20 1149 +#define _MATCH_CLASS_r31 1150 +#define _MATCH_KEYS_r23 1151 +#define _MATCH_MAPPING_r02 1152 +#define _MATCH_MAPPING_r12 1153 +#define _MATCH_MAPPING_r23 1154 +#define _MATCH_SEQUENCE_r02 1155 +#define _MATCH_SEQUENCE_r12 1156 +#define _MATCH_SEQUENCE_r23 1157 +#define _MAYBE_EXPAND_METHOD_r00 1158 +#define _MAYBE_EXPAND_METHOD_KW_r11 1159 +#define _MONITOR_CALL_r00 1160 +#define _MONITOR_CALL_KW_r11 1161 +#define _MONITOR_JUMP_BACKWARD_r00 1162 +#define _MONITOR_JUMP_BACKWARD_r11 1163 +#define _MONITOR_JUMP_BACKWARD_r22 1164 +#define _MONITOR_JUMP_BACKWARD_r33 1165 +#define _MONITOR_RESUME_r00 1166 +#define _NOP_r00 1167 +#define _NOP_r11 1168 +#define _NOP_r22 1169 +#define _NOP_r33 1170 +#define _POP_CALL_r20 1171 +#define _POP_CALL_LOAD_CONST_INLINE_BORROW_r21 1172 +#define _POP_CALL_ONE_r30 1173 +#define _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW_r31 1174 +#define _POP_CALL_TWO_r30 1175 +#define _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW_r31 1176 +#define _POP_EXCEPT_r10 1177 +#define _POP_ITER_r20 1178 +#define _POP_JUMP_IF_FALSE_r00 1179 +#define _POP_JUMP_IF_FALSE_r10 1180 +#define _POP_JUMP_IF_FALSE_r21 1181 +#define _POP_JUMP_IF_FALSE_r32 1182 +#define _POP_JUMP_IF_TRUE_r00 1183 +#define _POP_JUMP_IF_TRUE_r10 1184 +#define _POP_JUMP_IF_TRUE_r21 1185 +#define _POP_JUMP_IF_TRUE_r32 1186 +#define _POP_TOP_r10 1187 +#define _POP_TOP_FLOAT_r00 1188 +#define _POP_TOP_FLOAT_r10 1189 +#define _POP_TOP_FLOAT_r21 1190 +#define _POP_TOP_FLOAT_r32 1191 +#define _POP_TOP_INT_r00 1192 +#define _POP_TOP_INT_r10 1193 +#define _POP_TOP_INT_r21 1194 +#define _POP_TOP_INT_r32 1195 +#define _POP_TOP_LOAD_CONST_INLINE_r11 1196 +#define _POP_TOP_LOAD_CONST_INLINE_BORROW_r11 1197 +#define _POP_TOP_NOP_r00 1198 +#define _POP_TOP_NOP_r10 1199 +#define _POP_TOP_NOP_r21 1200 +#define _POP_TOP_NOP_r32 1201 +#define _POP_TOP_UNICODE_r00 1202 +#define _POP_TOP_UNICODE_r10 1203 +#define _POP_TOP_UNICODE_r21 1204 +#define _POP_TOP_UNICODE_r32 1205 +#define _POP_TWO_r20 1206 +#define _POP_TWO_LOAD_CONST_INLINE_BORROW_r21 1207 +#define _PUSH_EXC_INFO_r02 1208 +#define _PUSH_EXC_INFO_r12 1209 +#define _PUSH_EXC_INFO_r23 1210 +#define _PUSH_FRAME_r10 1211 +#define _PUSH_NULL_r01 1212 +#define _PUSH_NULL_r12 1213 +#define _PUSH_NULL_r23 1214 +#define _PUSH_NULL_CONDITIONAL_r00 1215 +#define _PY_FRAME_GENERAL_r01 1216 +#define _PY_FRAME_KW_r11 1217 +#define _QUICKEN_RESUME_r00 1218 +#define _QUICKEN_RESUME_r11 1219 +#define _QUICKEN_RESUME_r22 1220 +#define _QUICKEN_RESUME_r33 1221 +#define _REPLACE_WITH_TRUE_r02 1222 +#define _REPLACE_WITH_TRUE_r12 1223 +#define _REPLACE_WITH_TRUE_r23 1224 +#define _RESUME_CHECK_r00 1225 +#define _RESUME_CHECK_r11 1226 +#define _RESUME_CHECK_r22 1227 +#define _RESUME_CHECK_r33 1228 +#define _RETURN_GENERATOR_r01 1229 +#define _RETURN_VALUE_r11 1230 +#define _SAVE_RETURN_OFFSET_r00 1231 +#define _SAVE_RETURN_OFFSET_r11 1232 +#define _SAVE_RETURN_OFFSET_r22 1233 +#define _SAVE_RETURN_OFFSET_r33 1234 +#define _SEND_r22 1235 +#define _SEND_GEN_FRAME_r22 1236 +#define _SETUP_ANNOTATIONS_r00 1237 +#define _SET_ADD_r10 1238 +#define _SET_FUNCTION_ATTRIBUTE_r01 1239 +#define _SET_FUNCTION_ATTRIBUTE_r11 1240 +#define _SET_FUNCTION_ATTRIBUTE_r21 1241 +#define _SET_FUNCTION_ATTRIBUTE_r32 1242 +#define _SET_IP_r00 1243 +#define _SET_IP_r11 1244 +#define _SET_IP_r22 1245 +#define _SET_IP_r33 1246 +#define _SET_UPDATE_r10 1247 +#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r02 1248 +#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r12 1249 +#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r22 1250 +#define _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r32 1251 +#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r03 1252 +#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r13 1253 +#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r23 1254 +#define _SHUFFLE_3_LOAD_CONST_INLINE_BORROW_r33 1255 +#define _SPILL_OR_RELOAD_r01 1256 +#define _SPILL_OR_RELOAD_r02 1257 +#define _SPILL_OR_RELOAD_r03 1258 +#define _SPILL_OR_RELOAD_r10 1259 +#define _SPILL_OR_RELOAD_r12 1260 +#define _SPILL_OR_RELOAD_r13 1261 +#define _SPILL_OR_RELOAD_r20 1262 +#define _SPILL_OR_RELOAD_r21 1263 +#define _SPILL_OR_RELOAD_r23 1264 +#define _SPILL_OR_RELOAD_r30 1265 +#define _SPILL_OR_RELOAD_r31 1266 +#define _SPILL_OR_RELOAD_r32 1267 +#define _START_EXECUTOR_r00 1268 +#define _STORE_ATTR_r20 1269 +#define _STORE_ATTR_INSTANCE_VALUE_r21 1270 +#define _STORE_ATTR_SLOT_r21 1271 +#define _STORE_ATTR_WITH_HINT_r21 1272 +#define _STORE_DEREF_r10 1273 +#define _STORE_FAST_LOAD_FAST_r11 1274 +#define _STORE_FAST_STORE_FAST_r20 1275 +#define _STORE_GLOBAL_r10 1276 +#define _STORE_NAME_r10 1277 +#define _STORE_SLICE_r30 1278 +#define _STORE_SUBSCR_r30 1279 +#define _STORE_SUBSCR_DICT_r31 1280 +#define _STORE_SUBSCR_LIST_INT_r32 1281 +#define _SWAP_r11 1282 +#define _SWAP_2_r02 1283 +#define _SWAP_2_r12 1284 +#define _SWAP_2_r22 1285 +#define _SWAP_2_r33 1286 +#define _SWAP_3_r03 1287 +#define _SWAP_3_r13 1288 +#define _SWAP_3_r23 1289 +#define _SWAP_3_r33 1290 +#define _SWAP_FAST_r01 1291 +#define _SWAP_FAST_r11 1292 +#define _SWAP_FAST_r22 1293 +#define _SWAP_FAST_r33 1294 +#define _SWAP_FAST_0_r01 1295 +#define _SWAP_FAST_0_r11 1296 +#define _SWAP_FAST_0_r22 1297 +#define _SWAP_FAST_0_r33 1298 +#define _SWAP_FAST_1_r01 1299 +#define _SWAP_FAST_1_r11 1300 +#define _SWAP_FAST_1_r22 1301 +#define _SWAP_FAST_1_r33 1302 +#define _SWAP_FAST_2_r01 1303 +#define _SWAP_FAST_2_r11 1304 +#define _SWAP_FAST_2_r22 1305 +#define _SWAP_FAST_2_r33 1306 +#define _SWAP_FAST_3_r01 1307 +#define _SWAP_FAST_3_r11 1308 +#define _SWAP_FAST_3_r22 1309 +#define _SWAP_FAST_3_r33 1310 +#define _SWAP_FAST_4_r01 1311 +#define _SWAP_FAST_4_r11 1312 +#define _SWAP_FAST_4_r22 1313 +#define _SWAP_FAST_4_r33 1314 +#define _SWAP_FAST_5_r01 1315 +#define _SWAP_FAST_5_r11 1316 +#define _SWAP_FAST_5_r22 1317 +#define _SWAP_FAST_5_r33 1318 +#define _SWAP_FAST_6_r01 1319 +#define _SWAP_FAST_6_r11 1320 +#define _SWAP_FAST_6_r22 1321 +#define _SWAP_FAST_6_r33 1322 +#define _SWAP_FAST_7_r01 1323 +#define _SWAP_FAST_7_r11 1324 +#define _SWAP_FAST_7_r22 1325 +#define _SWAP_FAST_7_r33 1326 +#define _TIER2_RESUME_CHECK_r00 1327 +#define _TIER2_RESUME_CHECK_r11 1328 +#define _TIER2_RESUME_CHECK_r22 1329 +#define _TIER2_RESUME_CHECK_r33 1330 +#define _TO_BOOL_r11 1331 +#define _TO_BOOL_BOOL_r01 1332 +#define _TO_BOOL_BOOL_r11 1333 +#define _TO_BOOL_BOOL_r22 1334 +#define _TO_BOOL_BOOL_r33 1335 +#define _TO_BOOL_INT_r11 1336 +#define _TO_BOOL_LIST_r11 1337 +#define _TO_BOOL_NONE_r01 1338 +#define _TO_BOOL_NONE_r11 1339 +#define _TO_BOOL_NONE_r22 1340 +#define _TO_BOOL_NONE_r33 1341 +#define _TO_BOOL_STR_r11 1342 +#define _TRACE_RECORD_r00 1343 +#define _UNARY_INVERT_r11 1344 +#define _UNARY_NEGATIVE_r11 1345 +#define _UNARY_NOT_r01 1346 +#define _UNARY_NOT_r11 1347 +#define _UNARY_NOT_r22 1348 +#define _UNARY_NOT_r33 1349 +#define _UNPACK_EX_r10 1350 +#define _UNPACK_SEQUENCE_r10 1351 +#define _UNPACK_SEQUENCE_LIST_r10 1352 +#define _UNPACK_SEQUENCE_TUPLE_r10 1353 +#define _UNPACK_SEQUENCE_TWO_TUPLE_r12 1354 +#define _WITH_EXCEPT_START_r33 1355 +#define _YIELD_VALUE_r11 1356 +#define MAX_UOP_REGS_ID 1356 #ifdef __cplusplus } diff --git a/Include/internal/pycore_uop_metadata.h b/Include/internal/pycore_uop_metadata.h index d65769edc6e45a..7dc7f456215d85 100644 --- a/Include/internal/pycore_uop_metadata.h +++ b/Include/internal/pycore_uop_metadata.h @@ -98,7 +98,7 @@ const uint32_t _PyUop_Flags[MAX_UOP_ID+1] = { [_GUARD_NOS_UNICODE] = HAS_EXIT_FLAG, [_GUARD_TOS_UNICODE] = HAS_EXIT_FLAG, [_TO_BOOL_STR] = HAS_ESCAPES_FLAG, - [_REPLACE_WITH_TRUE] = HAS_ESCAPES_FLAG, + [_REPLACE_WITH_TRUE] = 0, [_UNARY_INVERT] = HAS_ERROR_FLAG | HAS_ESCAPES_FLAG, [_GUARD_NOS_INT] = HAS_EXIT_FLAG, [_GUARD_TOS_INT] = HAS_EXIT_FLAG, @@ -338,6 +338,7 @@ const uint32_t _PyUop_Flags[MAX_UOP_ID+1] = { [_POP_TWO_LOAD_CONST_INLINE_BORROW] = HAS_ESCAPES_FLAG, [_POP_CALL_LOAD_CONST_INLINE_BORROW] = HAS_ESCAPES_FLAG, [_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW] = HAS_ESCAPES_FLAG, + [_INSERT_1_LOAD_CONST_INLINE_BORROW] = 0, [_SHUFFLE_2_LOAD_CONST_INLINE_BORROW] = 0, [_SHUFFLE_3_LOAD_CONST_INLINE_BORROW] = 0, [_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW] = HAS_ESCAPES_FLAG, @@ -938,11 +939,11 @@ const _PyUopCachingInfo _PyUop_Caching[MAX_UOP_ID+1] = { }, }, [_REPLACE_WITH_TRUE] = { - .best = { 1, 1, 1, 1 }, + .best = { 0, 1, 2, 2 }, .entries = { - { -1, -1, -1 }, - { 1, 1, _REPLACE_WITH_TRUE_r11 }, - { -1, -1, -1 }, + { 2, 0, _REPLACE_WITH_TRUE_r02 }, + { 2, 1, _REPLACE_WITH_TRUE_r12 }, + { 3, 2, _REPLACE_WITH_TRUE_r23 }, { -1, -1, -1 }, }, }, @@ -3097,6 +3098,15 @@ const _PyUopCachingInfo _PyUop_Caching[MAX_UOP_ID+1] = { { 1, 3, _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW_r31 }, }, }, + [_INSERT_1_LOAD_CONST_INLINE_BORROW] = { + .best = { 0, 1, 2, 2 }, + .entries = { + { 2, 0, _INSERT_1_LOAD_CONST_INLINE_BORROW_r02 }, + { 2, 1, _INSERT_1_LOAD_CONST_INLINE_BORROW_r12 }, + { 3, 2, _INSERT_1_LOAD_CONST_INLINE_BORROW_r23 }, + { -1, -1, -1 }, + }, + }, [_SHUFFLE_2_LOAD_CONST_INLINE_BORROW] = { .best = { 0, 1, 2, 3 }, .entries = { @@ -3451,7 +3461,9 @@ const uint16_t _PyUop_Uncached[MAX_UOP_REGS_ID+1] = { [_GUARD_TOS_UNICODE_r22] = _GUARD_TOS_UNICODE, [_GUARD_TOS_UNICODE_r33] = _GUARD_TOS_UNICODE, [_TO_BOOL_STR_r11] = _TO_BOOL_STR, - [_REPLACE_WITH_TRUE_r11] = _REPLACE_WITH_TRUE, + [_REPLACE_WITH_TRUE_r02] = _REPLACE_WITH_TRUE, + [_REPLACE_WITH_TRUE_r12] = _REPLACE_WITH_TRUE, + [_REPLACE_WITH_TRUE_r23] = _REPLACE_WITH_TRUE, [_UNARY_INVERT_r11] = _UNARY_INVERT, [_GUARD_NOS_INT_r02] = _GUARD_NOS_INT, [_GUARD_NOS_INT_r12] = _GUARD_NOS_INT, @@ -3913,6 +3925,9 @@ const uint16_t _PyUop_Uncached[MAX_UOP_REGS_ID+1] = { [_POP_TWO_LOAD_CONST_INLINE_BORROW_r21] = _POP_TWO_LOAD_CONST_INLINE_BORROW, [_POP_CALL_LOAD_CONST_INLINE_BORROW_r21] = _POP_CALL_LOAD_CONST_INLINE_BORROW, [_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW_r31] = _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW, + [_INSERT_1_LOAD_CONST_INLINE_BORROW_r02] = _INSERT_1_LOAD_CONST_INLINE_BORROW, + [_INSERT_1_LOAD_CONST_INLINE_BORROW_r12] = _INSERT_1_LOAD_CONST_INLINE_BORROW, + [_INSERT_1_LOAD_CONST_INLINE_BORROW_r23] = _INSERT_1_LOAD_CONST_INLINE_BORROW, [_SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r02] = _SHUFFLE_2_LOAD_CONST_INLINE_BORROW, [_SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r12] = _SHUFFLE_2_LOAD_CONST_INLINE_BORROW, [_SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r22] = _SHUFFLE_2_LOAD_CONST_INLINE_BORROW, @@ -4537,6 +4552,10 @@ const char *const _PyOpcode_uop_name[MAX_UOP_REGS_ID+1] = { [_INIT_CALL_PY_EXACT_ARGS_3_r01] = "_INIT_CALL_PY_EXACT_ARGS_3_r01", [_INIT_CALL_PY_EXACT_ARGS_4] = "_INIT_CALL_PY_EXACT_ARGS_4", [_INIT_CALL_PY_EXACT_ARGS_4_r01] = "_INIT_CALL_PY_EXACT_ARGS_4_r01", + [_INSERT_1_LOAD_CONST_INLINE_BORROW] = "_INSERT_1_LOAD_CONST_INLINE_BORROW", + [_INSERT_1_LOAD_CONST_INLINE_BORROW_r02] = "_INSERT_1_LOAD_CONST_INLINE_BORROW_r02", + [_INSERT_1_LOAD_CONST_INLINE_BORROW_r12] = "_INSERT_1_LOAD_CONST_INLINE_BORROW_r12", + [_INSERT_1_LOAD_CONST_INLINE_BORROW_r23] = "_INSERT_1_LOAD_CONST_INLINE_BORROW_r23", [_INSERT_NULL] = "_INSERT_NULL", [_INSERT_NULL_r10] = "_INSERT_NULL_r10", [_IS_NONE] = "_IS_NONE", @@ -4855,7 +4874,9 @@ const char *const _PyOpcode_uop_name[MAX_UOP_REGS_ID+1] = { [_PY_FRAME_KW] = "_PY_FRAME_KW", [_PY_FRAME_KW_r11] = "_PY_FRAME_KW_r11", [_REPLACE_WITH_TRUE] = "_REPLACE_WITH_TRUE", - [_REPLACE_WITH_TRUE_r11] = "_REPLACE_WITH_TRUE_r11", + [_REPLACE_WITH_TRUE_r02] = "_REPLACE_WITH_TRUE_r02", + [_REPLACE_WITH_TRUE_r12] = "_REPLACE_WITH_TRUE_r12", + [_REPLACE_WITH_TRUE_r23] = "_REPLACE_WITH_TRUE_r23", [_RESUME_CHECK] = "_RESUME_CHECK", [_RESUME_CHECK_r00] = "_RESUME_CHECK_r00", [_RESUME_CHECK_r11] = "_RESUME_CHECK_r11", @@ -5648,6 +5669,8 @@ int _PyUop_num_popped(int opcode, int oparg) return 2; case _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW: return 3; + case _INSERT_1_LOAD_CONST_INLINE_BORROW: + return 1; case _SHUFFLE_2_LOAD_CONST_INLINE_BORROW: return 3; case _SHUFFLE_3_LOAD_CONST_INLINE_BORROW: diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py index e7a12e4d0b6d57..42edb73496c752 100644 --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -130,6 +130,10 @@ tzdata - Run tests that require timezone data. + xpickle - Test pickle and _pickle against Python 3.6, 3.7, 3.8 + and 3.9 to test backwards compatibility. These tests + may take very long to complete. + To enable all resources except one, use '-uall,-'. For example, to run all the tests except for the gui tests, give the option '-uall,-gui'. diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index cfb009c203ee80..1daa9c7baf8211 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -41,7 +41,7 @@ # - tzdata: while needed to validate fully test_datetime, it makes # test_datetime too slow (15-20 min on some buildbots) and so is disabled by # default (see bpo-30822). -RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile', 'tzdata') +RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile', 'tzdata', 'xpickle') # Types for types hints diff --git a/Lib/test/picklecommon.py b/Lib/test/picklecommon.py new file mode 100644 index 00000000000000..fece50f17fecca --- /dev/null +++ b/Lib/test/picklecommon.py @@ -0,0 +1,353 @@ +# Classes used for pickle testing. +# They are moved to separate file, so they can be loaded +# in other Python version for test_xpickle. + +import sys + +class C: + def __eq__(self, other): + return self.__dict__ == other.__dict__ + +# For test_load_classic_instance +class D(C): + def __init__(self, arg): + pass + +class E(C): + def __getinitargs__(self): + return () + +import __main__ +__main__.C = C +C.__module__ = "__main__" +__main__.D = D +D.__module__ = "__main__" +__main__.E = E +E.__module__ = "__main__" + +# Simple mutable object. +class Object: + pass + +# Hashable immutable key object containing unheshable mutable data. +class K: + def __init__(self, value): + self.value = value + + def __reduce__(self): + # Shouldn't support the recursion itself + return K, (self.value,) + +# For test_misc +class myint(int): + def __init__(self, x): + self.str = str(x) + +# For test_misc and test_getinitargs +class initarg(C): + + def __init__(self, a, b): + self.a = a + self.b = b + + def __getinitargs__(self): + return self.a, self.b + +# For test_metaclass +class metaclass(type): + pass + +if sys.version_info >= (3,): + # Syntax not compatible with Python 2 + exec(''' +class use_metaclass(object, metaclass=metaclass): + pass +''') +else: + class use_metaclass(object): + __metaclass__ = metaclass + + +# Test classes for reduce_ex + +class R: + def __init__(self, reduce=None): + self.reduce = reduce + def __reduce__(self, proto): + return self.reduce + +class REX: + def __init__(self, reduce_ex=None): + self.reduce_ex = reduce_ex + def __reduce_ex__(self, proto): + return self.reduce_ex + +class REX_one(object): + """No __reduce_ex__ here, but inheriting it from object""" + _reduce_called = 0 + def __reduce__(self): + self._reduce_called = 1 + return REX_one, () + +class REX_two(object): + """No __reduce__ here, but inheriting it from object""" + _proto = None + def __reduce_ex__(self, proto): + self._proto = proto + return REX_two, () + +class REX_three(object): + _proto = None + def __reduce_ex__(self, proto): + self._proto = proto + return REX_two, () + def __reduce__(self): + raise AssertionError("This __reduce__ shouldn't be called") + +class REX_four(object): + """Calling base class method should succeed""" + _proto = None + def __reduce_ex__(self, proto): + self._proto = proto + return object.__reduce_ex__(self, proto) + +class REX_five(object): + """This one used to fail with infinite recursion""" + _reduce_called = 0 + def __reduce__(self): + self._reduce_called = 1 + return object.__reduce__(self) + +class REX_six(object): + """This class is used to check the 4th argument (list iterator) of + the reduce protocol. + """ + def __init__(self, items=None): + self.items = items if items is not None else [] + def __eq__(self, other): + return type(self) is type(other) and self.items == other.items + def append(self, item): + self.items.append(item) + def __reduce__(self): + return type(self), (), None, iter(self.items), None + +class REX_seven(object): + """This class is used to check the 5th argument (dict iterator) of + the reduce protocol. + """ + def __init__(self, table=None): + self.table = table if table is not None else {} + def __eq__(self, other): + return type(self) is type(other) and self.table == other.table + def __setitem__(self, key, value): + self.table[key] = value + def __reduce__(self): + return type(self), (), None, None, iter(self.table.items()) + +class REX_state(object): + """This class is used to check the 3th argument (state) of + the reduce protocol. + """ + def __init__(self, state=None): + self.state = state + def __eq__(self, other): + return type(self) is type(other) and self.state == other.state + def __setstate__(self, state): + self.state = state + def __reduce__(self): + return type(self), (), self.state + +# For test_reduce_ex_None +class REX_None: + """ Setting __reduce_ex__ to None should fail """ + __reduce_ex__ = None + +# For test_reduce_None +class R_None: + """ Setting __reduce__ to None should fail """ + __reduce__ = None + +# For test_pickle_setstate_None +class C_None_setstate: + """ Setting __setstate__ to None should fail """ + def __getstate__(self): + return 1 + + __setstate__ = None + + +# Test classes for newobj + +# For test_newobj_generic and test_newobj_proxies + +class MyInt(int): + sample = 1 + +if sys.version_info >= (3,): + class MyLong(int): + sample = 1 +else: + class MyLong(long): + sample = long(1) + +class MyFloat(float): + sample = 1.0 + +class MyComplex(complex): + sample = 1.0 + 0.0j + +class MyStr(str): + sample = "hello" + +if sys.version_info >= (3,): + class MyUnicode(str): + sample = "hello \u1234" +else: + class MyUnicode(unicode): + sample = unicode(r"hello \u1234", "raw-unicode-escape") + +class MyTuple(tuple): + sample = (1, 2, 3) + +class MyList(list): + sample = [1, 2, 3] + +class MyDict(dict): + sample = {"a": 1, "b": 2} + +class MySet(set): + sample = {"a", "b"} + +class MyFrozenSet(frozenset): + sample = frozenset({"a", "b"}) + +myclasses = [MyInt, MyLong, MyFloat, + MyComplex, + MyStr, MyUnicode, + MyTuple, MyList, MyDict, MySet, MyFrozenSet] + +# For test_newobj_overridden_new +class MyIntWithNew(int): + def __new__(cls, value): + raise AssertionError + +class MyIntWithNew2(MyIntWithNew): + __new__ = int.__new__ + + +# For test_newobj_list_slots +class SlotList(MyList): + __slots__ = ["foo"] + +# Ruff "redefined while unused" false positive here due to `global` variables +# being assigned (and then restored) from within test methods earlier in the file +class SimpleNewObj(int): # noqa: F811 + def __init__(self, *args, **kwargs): + # raise an error, to make sure this isn't called + raise TypeError("SimpleNewObj.__init__() didn't expect to get called") + def __eq__(self, other): + return int(self) == int(other) and self.__dict__ == other.__dict__ + +class ComplexNewObj(SimpleNewObj): + def __getnewargs__(self): + return ('%X' % self, 16) + +class ComplexNewObjEx(SimpleNewObj): + def __getnewargs_ex__(self): + return ('%X' % self,), {'base': 16} + + +class ZeroCopyBytes(bytes): + readonly = True + c_contiguous = True + f_contiguous = True + zero_copy_reconstruct = True + + def __reduce_ex__(self, protocol): + if protocol >= 5: + import pickle + return type(self)._reconstruct, (pickle.PickleBuffer(self),), None + else: + return type(self)._reconstruct, (bytes(self),) + + def __repr__(self): + return "{}({!r})".format(self.__class__.__name__, bytes(self)) + + __str__ = __repr__ + + @classmethod + def _reconstruct(cls, obj): + with memoryview(obj) as m: + obj = m.obj + if type(obj) is cls: + # Zero-copy + return obj + else: + return cls(obj) + + +class ZeroCopyBytearray(bytearray): + readonly = False + c_contiguous = True + f_contiguous = True + zero_copy_reconstruct = True + + def __reduce_ex__(self, protocol): + if protocol >= 5: + import pickle + return type(self)._reconstruct, (pickle.PickleBuffer(self),), None + else: + return type(self)._reconstruct, (bytes(self),) + + def __repr__(self): + return "{}({!r})".format(self.__class__.__name__, bytes(self)) + + __str__ = __repr__ + + @classmethod + def _reconstruct(cls, obj): + with memoryview(obj) as m: + obj = m.obj + if type(obj) is cls: + # Zero-copy + return obj + else: + return cls(obj) + + +# For test_nested_names +class Nested: + class A: + class B: + class C: + pass + +# For test_py_methods +class PyMethodsTest: + @staticmethod + def cheese(): + return "cheese" + @classmethod + def wine(cls): + assert cls is PyMethodsTest + return "wine" + def biscuits(self): + assert isinstance(self, PyMethodsTest) + return "biscuits" + class Nested: + "Nested class" + @staticmethod + def ketchup(): + return "ketchup" + @classmethod + def maple(cls): + assert cls is PyMethodsTest.Nested + return "maple" + def pie(self): + assert isinstance(self, PyMethodsTest.Nested) + return "pie" + +# For test_c_methods +class Subclass(tuple): + class Nested(str): + pass diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 490b34572849e3..09bfb374732e86 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -15,6 +15,7 @@ import types import unittest import weakref +import __main__ from textwrap import dedent from http.cookies import SimpleCookie @@ -26,13 +27,15 @@ from test import support from test.support import os_helper from test.support import ( - TestFailed, run_with_locales, no_tracing, + run_with_locales, no_tracing, _2G, _4G, bigmemtest ) from test.support.import_helper import forget from test.support.os_helper import TESTFN from test.support import threading_helper from test.support.warnings_helper import save_restore_warnings_filters +from test import picklecommon +from test.picklecommon import * from pickle import bytes_types @@ -141,58 +144,6 @@ def restore(self): if pair is not None: copyreg.add_extension(pair[0], pair[1], code) -class C: - def __eq__(self, other): - return self.__dict__ == other.__dict__ - -class D(C): - def __init__(self, arg): - pass - -class E(C): - def __getinitargs__(self): - return () - -import __main__ -__main__.C = C -C.__module__ = "__main__" -__main__.D = D -D.__module__ = "__main__" -__main__.E = E -E.__module__ = "__main__" - -# Simple mutable object. -class Object: - pass - -# Hashable immutable key object containing unheshable mutable data. -class K: - def __init__(self, value): - self.value = value - - def __reduce__(self): - # Shouldn't support the recursion itself - return K, (self.value,) - -class myint(int): - def __init__(self, x): - self.str = str(x) - -class initarg(C): - - def __init__(self, a, b): - self.a = a - self.b = b - - def __getinitargs__(self): - return self.a, self.b - -class metaclass(type): - pass - -class use_metaclass(object, metaclass=metaclass): - pass - class pickling_metaclass(type): def __eq__(self, other): return (type(self) == type(other) and @@ -207,62 +158,6 @@ def create_dynamic_class(name, bases): return result -class ZeroCopyBytes(bytes): - readonly = True - c_contiguous = True - f_contiguous = True - zero_copy_reconstruct = True - - def __reduce_ex__(self, protocol): - if protocol >= 5: - return type(self)._reconstruct, (pickle.PickleBuffer(self),), None - else: - return type(self)._reconstruct, (bytes(self),) - - def __repr__(self): - return "{}({!r})".format(self.__class__.__name__, bytes(self)) - - __str__ = __repr__ - - @classmethod - def _reconstruct(cls, obj): - with memoryview(obj) as m: - obj = m.obj - if type(obj) is cls: - # Zero-copy - return obj - else: - return cls(obj) - - -class ZeroCopyBytearray(bytearray): - readonly = False - c_contiguous = True - f_contiguous = True - zero_copy_reconstruct = True - - def __reduce_ex__(self, protocol): - if protocol >= 5: - return type(self)._reconstruct, (pickle.PickleBuffer(self),), None - else: - return type(self)._reconstruct, (bytes(self),) - - def __repr__(self): - return "{}({!r})".format(self.__class__.__name__, bytes(self)) - - __str__ = __repr__ - - @classmethod - def _reconstruct(cls, obj): - with memoryview(obj) as m: - obj = m.obj - if type(obj) is cls: - # Zero-copy - return obj - else: - return cls(obj) - - if _testbuffer is not None: class PicklableNDArray: @@ -307,9 +202,10 @@ def __ne__(self, other): return not (self == other) def __repr__(self): - return (f"{type(self)}(shape={self.array.shape}," - f"strides={self.array.strides}, " - f"bytes={self.array.tobytes()})") + return ("{name}(shape={array.shape}," + "strides={array.strides}, " + "bytes={array.tobytes()})").format( + name=type(self).__name__, array=self.array.shape) def __reduce_ex__(self, protocol): if not self.array.contiguous: @@ -1530,9 +1426,9 @@ def check(key, exc): self.loads(b'\x82\x01.') check(None, ValueError) check((), ValueError) - check((__name__,), (TypeError, ValueError)) - check((__name__, "MyList", "x"), (TypeError, ValueError)) - check((__name__, None), (TypeError, ValueError)) + check((MyList.__module__,), (TypeError, ValueError)) + check((MyList.__module__, "MyList", "x"), (TypeError, ValueError)) + check((MyList.__module__, None), (TypeError, ValueError)) check((None, "MyList"), (TypeError, ValueError)) def test_bad_reduce(self): @@ -1846,7 +1742,7 @@ def test_bad_reduce_result(self): self.assertEqual(str(cm.exception), '__reduce__ must return a string or tuple, not list') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) obj = REX((print,)) for proto in protocols: @@ -1856,7 +1752,7 @@ def test_bad_reduce_result(self): self.assertEqual(str(cm.exception), 'tuple returned by __reduce__ must contain 2 through 6 elements') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) obj = REX((print, (), None, None, None, None, None)) for proto in protocols: @@ -1866,7 +1762,7 @@ def test_bad_reduce_result(self): self.assertEqual(str(cm.exception), 'tuple returned by __reduce__ must contain 2 through 6 elements') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_bad_reconstructor(self): obj = REX((42, ())) @@ -1878,7 +1774,7 @@ def test_bad_reconstructor(self): 'first item of the tuple returned by __reduce__ ' 'must be callable, not int') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_reconstructor(self): obj = REX((UnpickleableCallable(), ())) @@ -1887,8 +1783,8 @@ def test_unpickleable_reconstructor(self): with self.assertRaises(CustomError) as cm: self.dumps(obj, proto) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX reconstructor', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX reconstructor', + f'when serializing {REX.__module__}.REX object']) def test_bad_reconstructor_args(self): obj = REX((print, [])) @@ -1900,7 +1796,7 @@ def test_bad_reconstructor_args(self): 'second item of the tuple returned by __reduce__ ' 'must be a tuple, not list') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_reconstructor_args(self): obj = REX((print, (1, 2, UNPICKLEABLE))) @@ -1910,8 +1806,8 @@ def test_unpickleable_reconstructor_args(self): self.dumps(obj, proto) self.assertEqual(cm.exception.__notes__, [ 'when serializing tuple item 2', - 'when serializing test.pickletester.REX reconstructor arguments', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX reconstructor arguments', + f'when serializing {REX.__module__}.REX object']) def test_bad_newobj_args(self): obj = REX((copyreg.__newobj__, ())) @@ -1923,7 +1819,7 @@ def test_bad_newobj_args(self): 'tuple index out of range', '__newobj__ expected at least 1 argument, got 0'}) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) obj = REX((copyreg.__newobj__, [REX])) for proto in protocols[2:]: @@ -1934,7 +1830,7 @@ def test_bad_newobj_args(self): 'second item of the tuple returned by __reduce__ ' 'must be a tuple, not list') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_bad_newobj_class(self): obj = REX((copyreg.__newobj__, (NoNew(),))) @@ -1944,9 +1840,9 @@ def test_bad_newobj_class(self): self.dumps(obj, proto) self.assertIn(str(cm.exception), { 'first argument to __newobj__() has no __new__', - f'first argument to __newobj__() must be a class, not {__name__}.NoNew'}) + f'first argument to __newobj__() must be a class, not {NoNew.__module__}.NoNew'}) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_wrong_newobj_class(self): obj = REX((copyreg.__newobj__, (str,))) @@ -1957,7 +1853,7 @@ def test_wrong_newobj_class(self): self.assertEqual(str(cm.exception), f'first argument to __newobj__() must be {REX!r}, not {str!r}') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_newobj_class(self): class LocalREX(REX): pass @@ -1985,13 +1881,13 @@ def test_unpickleable_newobj_args(self): if proto >= 2: self.assertEqual(cm.exception.__notes__, [ 'when serializing tuple item 2', - 'when serializing test.pickletester.REX __new__ arguments', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX __new__ arguments', + f'when serializing {REX.__module__}.REX object']) else: self.assertEqual(cm.exception.__notes__, [ 'when serializing tuple item 3', - 'when serializing test.pickletester.REX reconstructor arguments', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX reconstructor arguments', + f'when serializing {REX.__module__}.REX object']) def test_bad_newobj_ex_args(self): obj = REX((copyreg.__newobj_ex__, ())) @@ -2003,7 +1899,7 @@ def test_bad_newobj_ex_args(self): 'not enough values to unpack (expected 3, got 0)', '__newobj_ex__ expected 3 arguments, got 0'}) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) obj = REX((copyreg.__newobj_ex__, 42)) for proto in protocols[2:]: @@ -2014,7 +1910,7 @@ def test_bad_newobj_ex_args(self): 'second item of the tuple returned by __reduce__ ' 'must be a tuple, not int') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) obj = REX((copyreg.__newobj_ex__, (REX, 42, {}))) if self.pickler is pickle._Pickler: @@ -2025,7 +1921,7 @@ def test_bad_newobj_ex_args(self): self.assertEqual(str(cm.exception), 'Value after * must be an iterable, not int') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) else: for proto in protocols[2:]: with self.subTest(proto=proto): @@ -2034,7 +1930,7 @@ def test_bad_newobj_ex_args(self): self.assertEqual(str(cm.exception), 'second argument to __newobj_ex__() must be a tuple, not int') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) obj = REX((copyreg.__newobj_ex__, (REX, (), []))) if self.pickler is pickle._Pickler: @@ -2045,7 +1941,7 @@ def test_bad_newobj_ex_args(self): self.assertEqual(str(cm.exception), 'Value after ** must be a mapping, not list') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) else: for proto in protocols[2:]: with self.subTest(proto=proto): @@ -2054,7 +1950,7 @@ def test_bad_newobj_ex_args(self): self.assertEqual(str(cm.exception), 'third argument to __newobj_ex__() must be a dict, not list') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_bad_newobj_ex__class(self): obj = REX((copyreg.__newobj_ex__, (NoNew(), (), {}))) @@ -2064,9 +1960,9 @@ def test_bad_newobj_ex__class(self): self.dumps(obj, proto) self.assertIn(str(cm.exception), { 'first argument to __newobj_ex__() has no __new__', - f'first argument to __newobj_ex__() must be a class, not {__name__}.NoNew'}) + f'first argument to __newobj_ex__() must be a class, not {NoNew.__module__}.NoNew'}) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_wrong_newobj_ex_class(self): if self.pickler is not pickle._Pickler: @@ -2079,7 +1975,7 @@ def test_wrong_newobj_ex_class(self): self.assertEqual(str(cm.exception), f'first argument to __newobj_ex__() must be {REX}, not {str}') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_newobj_ex_class(self): class LocalREX(REX): pass @@ -2115,22 +2011,22 @@ def test_unpickleable_newobj_ex_args(self): if proto >= 4: self.assertEqual(cm.exception.__notes__, [ 'when serializing tuple item 2', - 'when serializing test.pickletester.REX __new__ arguments', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX __new__ arguments', + f'when serializing {REX.__module__}.REX object']) elif proto >= 2: self.assertEqual(cm.exception.__notes__, [ 'when serializing tuple item 3', 'when serializing tuple item 1', 'when serializing functools.partial state', 'when serializing functools.partial object', - 'when serializing test.pickletester.REX reconstructor', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX reconstructor', + f'when serializing {REX.__module__}.REX object']) else: self.assertEqual(cm.exception.__notes__, [ 'when serializing tuple item 2', 'when serializing tuple item 1', - 'when serializing test.pickletester.REX reconstructor arguments', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX reconstructor arguments', + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_newobj_ex_kwargs(self): obj = REX((copyreg.__newobj_ex__, (REX, (), {'a': UNPICKLEABLE}))) @@ -2141,22 +2037,22 @@ def test_unpickleable_newobj_ex_kwargs(self): if proto >= 4: self.assertEqual(cm.exception.__notes__, [ "when serializing dict item 'a'", - 'when serializing test.pickletester.REX __new__ arguments', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX __new__ arguments', + f'when serializing {REX.__module__}.REX object']) elif proto >= 2: self.assertEqual(cm.exception.__notes__, [ "when serializing dict item 'a'", 'when serializing tuple item 2', 'when serializing functools.partial state', 'when serializing functools.partial object', - 'when serializing test.pickletester.REX reconstructor', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX reconstructor', + f'when serializing {REX.__module__}.REX object']) else: self.assertEqual(cm.exception.__notes__, [ "when serializing dict item 'a'", 'when serializing tuple item 2', - 'when serializing test.pickletester.REX reconstructor arguments', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX reconstructor arguments', + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_state(self): obj = REX_state(UNPICKLEABLE) @@ -2165,8 +2061,8 @@ def test_unpickleable_state(self): with self.assertRaises(CustomError) as cm: self.dumps(obj, proto) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX_state state', - 'when serializing test.pickletester.REX_state object']) + f'when serializing {REX_state.__module__}.REX_state state', + f'when serializing {REX_state.__module__}.REX_state object']) def test_bad_state_setter(self): if self.pickler is pickle._Pickler: @@ -2180,7 +2076,7 @@ def test_bad_state_setter(self): 'sixth item of the tuple returned by __reduce__ ' 'must be callable, not int') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_state_setter(self): obj = REX((print, (), 'state', None, None, UnpickleableCallable())) @@ -2189,8 +2085,8 @@ def test_unpickleable_state_setter(self): with self.assertRaises(CustomError) as cm: self.dumps(obj, proto) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX state setter', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX state setter', + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_state_with_state_setter(self): obj = REX((print, (), UNPICKLEABLE, None, None, print)) @@ -2199,8 +2095,8 @@ def test_unpickleable_state_with_state_setter(self): with self.assertRaises(CustomError) as cm: self.dumps(obj, proto) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX state', - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX state', + f'when serializing {REX.__module__}.REX object']) def test_bad_object_list_items(self): # Issue4176: crash when 4th and 5th items of __reduce__() @@ -2215,7 +2111,7 @@ def test_bad_object_list_items(self): 'fourth item of the tuple returned by __reduce__ ' 'must be an iterator, not int'}) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) if self.pickler is not pickle._Pickler: # Python implementation is less strict and also accepts iterables. @@ -2228,7 +2124,7 @@ def test_bad_object_list_items(self): 'fourth item of the tuple returned by __reduce__ ' 'must be an iterator, not int') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_object_list_items(self): obj = REX_six([1, 2, UNPICKLEABLE]) @@ -2237,8 +2133,8 @@ def test_unpickleable_object_list_items(self): with self.assertRaises(CustomError) as cm: self.dumps(obj, proto) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX_six item 2', - 'when serializing test.pickletester.REX_six object']) + f'when serializing {REX_six.__module__}.REX_six item 2', + f'when serializing {REX_six.__module__}.REX_six object']) def test_bad_object_dict_items(self): # Issue4176: crash when 4th and 5th items of __reduce__() @@ -2253,7 +2149,7 @@ def test_bad_object_dict_items(self): 'fifth item of the tuple returned by __reduce__ ' 'must be an iterator, not int'}) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) for proto in protocols: obj = REX((dict, (), None, None, iter([('a',)]))) @@ -2264,7 +2160,7 @@ def test_bad_object_dict_items(self): 'not enough values to unpack (expected 2, got 1)', 'dict items iterator must return 2-tuples'}) self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) if self.pickler is not pickle._Pickler: # Python implementation is less strict and also accepts iterables. @@ -2276,7 +2172,7 @@ def test_bad_object_dict_items(self): self.assertEqual(str(cm.exception), 'dict items iterator must return 2-tuples') self.assertEqual(cm.exception.__notes__, [ - 'when serializing test.pickletester.REX object']) + f'when serializing {REX.__module__}.REX object']) def test_unpickleable_object_dict_items(self): obj = REX_seven({'a': UNPICKLEABLE}) @@ -2285,8 +2181,8 @@ def test_unpickleable_object_dict_items(self): with self.assertRaises(CustomError) as cm: self.dumps(obj, proto) self.assertEqual(cm.exception.__notes__, [ - "when serializing test.pickletester.REX_seven item 'a'", - 'when serializing test.pickletester.REX_seven object']) + f"when serializing {REX_seven.__module__}.REX_seven item 'a'", + f'when serializing {REX_seven.__module__}.REX_seven object']) def test_unpickleable_list_items(self): obj = [1, [2, 3, UNPICKLEABLE]] @@ -2379,15 +2275,15 @@ def test_unpickleable_frozenset_items(self): def test_global_lookup_error(self): # Global name does not exist obj = REX('spam') - obj.__module__ = __name__ + obj.__module__ = 'test.picklecommon' for proto in protocols: with self.subTest(proto=proto): with self.assertRaises(pickle.PicklingError) as cm: self.dumps(obj, proto) self.assertEqual(str(cm.exception), - f"Can't pickle {obj!r}: it's not found as {__name__}.spam") + f"Can't pickle {obj!r}: it's not found as test.picklecommon.spam") self.assertEqual(str(cm.exception.__context__), - f"module '{__name__}' has no attribute 'spam'") + "module 'test.picklecommon' has no attribute 'spam'") obj.__module__ = 'nonexisting' for proto in protocols: @@ -2608,7 +2504,7 @@ def persistent_id(self, obj): def test_bad_ext_code(self): # This should never happen in normal circumstances, because the type # and the value of the extension code is checked in copyreg.add_extension(). - key = (__name__, 'MyList') + key = (MyList.__module__, 'MyList') def check(code, exc): assert key not in copyreg._extension_registry assert code not in copyreg._inverted_registry @@ -2630,6 +2526,7 @@ def check(code, exc): class AbstractPickleTests: # Subclass must define self.dumps, self.loads. + py_version = sys.version_info # for test_xpickle optimized = False _testdata = AbstractUnpickleTests._testdata @@ -2642,24 +2539,33 @@ def setUp(self): def test_misc(self): # test various datatypes not tested by testdata for proto in protocols: - x = myint(4) - s = self.dumps(x, proto) - y = self.loads(s) - self.assert_is_copy(x, y) + with self.subTest('myint', proto=proto): + if self.py_version < (3, 0) and proto < 2: + self.skipTest('int subclasses are not interoperable with Python 2') + x = myint(4) + s = self.dumps(x, proto) + y = self.loads(s) + self.assert_is_copy(x, y) - x = (1, ()) - s = self.dumps(x, proto) - y = self.loads(s) - self.assert_is_copy(x, y) + with self.subTest('tuple', proto=proto): + x = (1, ()) + s = self.dumps(x, proto) + y = self.loads(s) + self.assert_is_copy(x, y) - x = initarg(1, x) - s = self.dumps(x, proto) - y = self.loads(s) - self.assert_is_copy(x, y) + with self.subTest('initarg', proto=proto): + if self.py_version < (3, 0): + self.skipTest('"classic" classes are not interoperable with Python 2') + x = initarg(1, x) + s = self.dumps(x, proto) + y = self.loads(s) + self.assert_is_copy(x, y) # XXX test __reduce__ protocol? def test_roundtrip_equality(self): + if self.py_version < (3, 0): + self.skipTest('"classic" classes are not interoperable with Python 2') expected = self._testdata for proto in protocols: s = self.dumps(expected, proto) @@ -2856,6 +2762,8 @@ def test_recursive_tuple_and_dict_like_key(self): self._test_recursive_tuple_and_dict_key(REX_seven, asdict=lambda x: x.table) def test_recursive_set(self): + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') # Set containing an immutable object containing the original set. y = set() y.add(K(y)) @@ -2879,6 +2787,8 @@ def test_recursive_set(self): def test_recursive_inst(self): # Mutable object containing itself. + if self.py_version < (3, 0): + self.skipTest('"classic" classes are not interoperable with Python 2') i = Object() i.attr = i for proto in protocols: @@ -2889,6 +2799,8 @@ def test_recursive_inst(self): self.assertIs(x.attr, x) def test_recursive_multi(self): + if self.py_version < (3, 0): + self.skipTest('"classic" classes are not interoperable with Python 2') l = [] d = {1:l} i = Object() @@ -2903,39 +2815,49 @@ def test_recursive_multi(self): self.assertEqual(list(x[0].attr.keys()), [1]) self.assertIs(x[0].attr[1], x) - def _test_recursive_collection_and_inst(self, factory): + def _test_recursive_collection_and_inst(self, factory, oldminproto=None): + if self.py_version < (3, 0): + self.skipTest('"classic" classes are not interoperable with Python 2') # Mutable object containing a collection containing the original # object. o = Object() o.attr = factory([o]) t = type(o.attr) - for proto in protocols: - s = self.dumps(o, proto) - x = self.loads(s) - self.assertIsInstance(x.attr, t) - self.assertEqual(len(x.attr), 1) - self.assertIsInstance(list(x.attr)[0], Object) - self.assertIs(list(x.attr)[0], x) + with self.subTest('obj -> {t.__name__} -> obj'): + for proto in protocols: + with self.subTest(proto=proto): + s = self.dumps(o, proto) + x = self.loads(s) + self.assertIsInstance(x.attr, t) + self.assertEqual(len(x.attr), 1) + self.assertIsInstance(list(x.attr)[0], Object) + self.assertIs(list(x.attr)[0], x) # Collection containing a mutable object containing the original # collection. o = o.attr - for proto in protocols: - s = self.dumps(o, proto) - x = self.loads(s) - self.assertIsInstance(x, t) - self.assertEqual(len(x), 1) - self.assertIsInstance(list(x)[0], Object) - self.assertIs(list(x)[0].attr, x) + with self.subTest(f'{t.__name__} -> obj -> {t.__name__}'): + if self.py_version < (3, 4) and oldminproto is None: + self.skipTest('not supported in Python < 3.4') + for proto in protocols: + with self.subTest(proto=proto): + if self.py_version < (3, 4) and proto < oldminproto: + self.skipTest(f'requires protocol {oldminproto} in Python < 3.4') + s = self.dumps(o, proto) + x = self.loads(s) + self.assertIsInstance(x, t) + self.assertEqual(len(x), 1) + self.assertIsInstance(list(x)[0], Object) + self.assertIs(list(x)[0].attr, x) def test_recursive_list_and_inst(self): - self._test_recursive_collection_and_inst(list) + self._test_recursive_collection_and_inst(list, oldminproto=0) def test_recursive_tuple_and_inst(self): - self._test_recursive_collection_and_inst(tuple) + self._test_recursive_collection_and_inst(tuple, oldminproto=0) def test_recursive_dict_and_inst(self): - self._test_recursive_collection_and_inst(dict.fromkeys) + self._test_recursive_collection_and_inst(dict.fromkeys, oldminproto=0) def test_recursive_set_and_inst(self): self._test_recursive_collection_and_inst(set) @@ -2944,13 +2866,13 @@ def test_recursive_frozenset_and_inst(self): self._test_recursive_collection_and_inst(frozenset) def test_recursive_list_subclass_and_inst(self): - self._test_recursive_collection_and_inst(MyList) + self._test_recursive_collection_and_inst(MyList, oldminproto=2) def test_recursive_tuple_subclass_and_inst(self): self._test_recursive_collection_and_inst(MyTuple) def test_recursive_dict_subclass_and_inst(self): - self._test_recursive_collection_and_inst(MyDict.fromkeys) + self._test_recursive_collection_and_inst(MyDict.fromkeys, oldminproto=2) def test_recursive_set_subclass_and_inst(self): self._test_recursive_collection_and_inst(MySet) @@ -3010,6 +2932,8 @@ def test_unicode_high_plane(self): def test_unicode_memoization(self): # Repeated str is re-used (even when escapes added). + if self.py_version < (3, 0): + self.skipTest('not supported in Python < 3.0') for proto in protocols: for s in '', 'xyz', 'xyz\n', 'x\\yz', 'x\xa1yz\r': p = self.dumps((s, s), proto) @@ -3029,23 +2953,27 @@ def test_bytes(self): self.assert_is_copy(s, self.loads(p)) def test_bytes_memoization(self): + array_types = [bytes] + if self.py_version >= (3, 4): + array_types += [ZeroCopyBytes] for proto in protocols: - for array_type in [bytes, ZeroCopyBytes]: + for array_type in array_types: for s in b'', b'xyz', b'xyz'*100: + b = array_type(s) + expected = (b, b) if self.py_version >= (3, 0) else (b.decode(),)*2 with self.subTest(proto=proto, array_type=array_type, s=s, independent=False): - b = array_type(s) p = self.dumps((b, b), proto) x, y = self.loads(p) self.assertIs(x, y) - self.assert_is_copy((b, b), (x, y)) + self.assert_is_copy(expected, (x, y)) + b2 = array_type(s) with self.subTest(proto=proto, array_type=array_type, s=s, independent=True): - b1, b2 = array_type(s), array_type(s) - p = self.dumps((b1, b2), proto) - # Note that (b1, b2) = self.loads(p) might have identical - # components, i.e., b1 is b2, but this is not always the + p = self.dumps((b, b2), proto) + # Note that (b, b2) = self.loads(p) might have identical + # components, i.e., b is b2, but this is not always the # case if the content is large (equality still holds). - self.assert_is_copy((b1, b2), self.loads(p)) + self.assert_is_copy(expected, self.loads(p)) def test_bytearray(self): for proto in protocols: @@ -3067,8 +2995,11 @@ def test_bytearray(self): self.assertTrue(opcode_in_pickle(pickle.BYTEARRAY8, p)) def test_bytearray_memoization(self): + array_types = [bytearray] + if self.py_version >= (3, 4): + array_types += [ZeroCopyBytearray] for proto in protocols: - for array_type in [bytearray, ZeroCopyBytearray]: + for array_type in array_types: for s in b'', b'xyz', b'xyz'*100: with self.subTest(proto=proto, array_type=array_type, s=s, independent=False): b = array_type(s) @@ -3142,12 +3073,17 @@ def test_float_format(self): def test_reduce(self): for proto in protocols: - inst = AAA() - dumped = self.dumps(inst, proto) - loaded = self.loads(dumped) - self.assertEqual(loaded, REDUCE_A) + with self.subTest(proto=proto): + if self.py_version < (3, 4) and proto < 3: + self.skipTest('str is not interoperable with Python < 3.4') + inst = AAA() + dumped = self.dumps(inst, proto) + loaded = self.loads(dumped) + self.assertEqual(loaded, REDUCE_A) def test_getinitargs(self): + if self.py_version < (3, 0): + self.skipTest('"classic" classes are not interoperable with Python 2') for proto in protocols: inst = initarg(1, 2) dumped = self.dumps(inst, proto) @@ -3155,6 +3091,7 @@ def test_getinitargs(self): self.assert_is_copy(inst, loaded) def test_metaclass(self): + self.assertEqual(type(use_metaclass), metaclass) a = use_metaclass() for proto in protocols: s = self.dumps(a, proto) @@ -3179,6 +3116,10 @@ def test_structseq(self): s = self.dumps(t, proto) u = self.loads(s) self.assert_is_copy(t, u) + if self.py_version < (3, 4): + # module 'os' has no attributes '_make_stat_result' and + # '_make_statvfs_result' + continue t = os.stat(os.curdir) s = self.dumps(t, proto) u = self.loads(s) @@ -3190,52 +3131,111 @@ def test_structseq(self): self.assert_is_copy(t, u) def test_ellipsis(self): + if self.py_version < (3, 3): + self.skipTest('not supported in Python < 3.3') for proto in protocols: - s = self.dumps(..., proto) - u = self.loads(s) - self.assertIs(..., u) + with self.subTest(proto=proto): + s = self.dumps(..., proto) + u = self.loads(s) + self.assertIs(..., u) def test_notimplemented(self): + if self.py_version < (3, 3): + self.skipTest('not supported in Python < 3.3') for proto in protocols: - s = self.dumps(NotImplemented, proto) - u = self.loads(s) - self.assertIs(NotImplemented, u) + with self.subTest(proto=proto): + s = self.dumps(NotImplemented, proto) + u = self.loads(s) + self.assertIs(NotImplemented, u) def test_singleton_types(self): # Issue #6477: Test that types of built-in singletons can be pickled. + if self.py_version < (3, 3): + self.skipTest('not supported in Python < 3.3') singletons = [None, ..., NotImplemented] for singleton in singletons: + t = type(singleton) for proto in protocols: - s = self.dumps(type(singleton), proto) - u = self.loads(s) - self.assertIs(type(singleton), u) + with self.subTest(name=t.__name__, proto=proto): + s = self.dumps(t, proto) + u = self.loads(s) + self.assertIs(t, u) def test_builtin_types(self): + new_names = { + 'bytes': (3, 0), + 'BuiltinImporter': (3, 3), + 'str': (3, 4), # not interoperable with Python < 3.4 + } for t in builtins.__dict__.values(): if isinstance(t, type) and not issubclass(t, BaseException): + if t.__name__ in new_names and self.py_version < new_names[t.__name__]: + continue for proto in protocols: - s = self.dumps(t, proto) - self.assertIs(self.loads(s), t) + with self.subTest(name=t.__name__, proto=proto): + s = self.dumps(t, proto) + self.assertIs(self.loads(s), t) def test_builtin_exceptions(self): + new_names = { + 'BlockingIOError': (3, 3), + 'BrokenPipeError': (3, 3), + 'ChildProcessError': (3, 3), + 'ConnectionError': (3, 3), + 'ConnectionAbortedError': (3, 3), + 'ConnectionRefusedError': (3, 3), + 'ConnectionResetError': (3, 3), + 'FileExistsError': (3, 3), + 'FileNotFoundError': (3, 3), + 'InterruptedError': (3, 3), + 'IsADirectoryError': (3, 3), + 'NotADirectoryError': (3, 3), + 'PermissionError': (3, 3), + 'ProcessLookupError': (3, 3), + 'TimeoutError': (3, 3), + 'RecursionError': (3, 5), + 'StopAsyncIteration': (3, 5), + 'ModuleNotFoundError': (3, 6), + 'EncodingWarning': (3, 10), + 'BaseExceptionGroup': (3, 11), + 'ExceptionGroup': (3, 11), + '_IncompleteInputError': (3, 13), + 'PythonFinalizationError': (3, 13), + } for t in builtins.__dict__.values(): if isinstance(t, type) and issubclass(t, BaseException): + if t.__name__ in new_names and self.py_version < new_names[t.__name__]: + continue for proto in protocols: - s = self.dumps(t, proto) - u = self.loads(s) - if proto <= 2 and issubclass(t, OSError) and t is not BlockingIOError: - self.assertIs(u, OSError) - elif proto <= 2 and issubclass(t, ImportError): - self.assertIs(u, ImportError) - else: - self.assertIs(u, t) + with self.subTest(name=t.__name__, proto=proto): + if self.py_version < (3, 3) and proto < 3: + self.skipTest('exception classes are not interoperable with Python < 3.3') + s = self.dumps(t, proto) + u = self.loads(s) + if proto <= 2 and issubclass(t, OSError) and t is not BlockingIOError: + self.assertIs(u, OSError) + elif proto <= 2 and issubclass(t, ImportError): + self.assertIs(u, ImportError) + else: + self.assertIs(u, t) def test_builtin_functions(self): + new_names = { + '__build_class__': (3, 0), + 'ascii': (3, 0), + 'exec': (3, 0), + 'breakpoint': (3, 7), + 'aiter': (3, 10), + 'anext': (3, 10), + } for t in builtins.__dict__.values(): if isinstance(t, types.BuiltinFunctionType): + if t.__name__ in new_names and self.py_version < new_names[t.__name__]: + continue for proto in protocols: - s = self.dumps(t, proto) - self.assertIs(self.loads(s), t) + with self.subTest(name=t.__name__, proto=proto): + s = self.dumps(t, proto) + self.assertIs(self.loads(s), t) # Tests for protocol 2 @@ -3248,6 +3248,9 @@ def test_proto(self): else: self.assertEqual(count_opcode(pickle.PROTO, pickled), 0) + def test_bad_proto(self): + if self.py_version < (3, 8): + self.skipTest('no protocol validation in Python < 3.8') oob = protocols[-1] + 1 # a future protocol build_none = pickle.NONE + pickle.STOP badpickle = pickle.PROTO + bytes([oob]) + build_none @@ -3359,57 +3362,65 @@ def test_newobj_list(self): def test_newobj_generic(self): for proto in protocols: for C in myclasses: - B = C.__base__ - x = C(C.sample) - x.foo = 42 - s = self.dumps(x, proto) - y = self.loads(s) - detail = (proto, C, B, x, y, type(y)) - self.assert_is_copy(x, y) # XXX revisit - self.assertEqual(B(x), B(y), detail) - self.assertEqual(x.__dict__, y.__dict__, detail) + with self.subTest(proto=proto, C=C): + if self.py_version < (3, 0) and proto < 2 and C in (MyInt, MyStr): + self.skipTest('int and str subclasses are not interoperable with Python 2') + if (3, 0) <= self.py_version < (3, 4) and proto < 2 and C in (MyStr, MyUnicode): + self.skipTest('str subclasses are not interoperable with Python < 3.4') + B = C.__base__ + x = C(C.sample) + x.foo = 42 + s = self.dumps(x, proto) + y = self.loads(s) + detail = (proto, C, B, x, y, type(y)) + self.assert_is_copy(x, y) # XXX revisit + self.assertEqual(B(x), B(y), detail) + self.assertEqual(x.__dict__, y.__dict__, detail) def test_newobj_proxies(self): # NEWOBJ should use the __class__ rather than the raw type classes = myclasses[:] # Cannot create weakproxies to these classes - for c in (MyInt, MyTuple): + for c in (MyInt, MyLong, MyTuple): classes.remove(c) for proto in protocols: for C in classes: - B = C.__base__ - x = C(C.sample) - x.foo = 42 - p = weakref.proxy(x) - s = self.dumps(p, proto) - y = self.loads(s) - self.assertEqual(type(y), type(x)) # rather than type(p) - detail = (proto, C, B, x, y, type(y)) - self.assertEqual(B(x), B(y), detail) - self.assertEqual(x.__dict__, y.__dict__, detail) + with self.subTest(proto=proto, C=C): + if self.py_version < (3, 4) and proto < 3 and C in (MyStr, MyUnicode): + self.skipTest('str subclasses are not interoperable with Python < 3.4') + B = C.__base__ + x = C(C.sample) + x.foo = 42 + p = weakref.proxy(x) + s = self.dumps(p, proto) + y = self.loads(s) + self.assertEqual(type(y), type(x)) # rather than type(p) + detail = (proto, C, B, x, y, type(y)) + self.assertEqual(B(x), B(y), detail) + self.assertEqual(x.__dict__, y.__dict__, detail) def test_newobj_overridden_new(self): # Test that Python class with C implemented __new__ is pickleable for proto in protocols: - x = MyIntWithNew2(1) - x.foo = 42 - s = self.dumps(x, proto) - y = self.loads(s) - self.assertIs(type(y), MyIntWithNew2) - self.assertEqual(int(y), 1) - self.assertEqual(y.foo, 42) + with self.subTest(proto=proto): + if self.py_version < (3, 0) and proto < 2: + self.skipTest('int subclasses are not interoperable with Python 2') + x = MyIntWithNew2(1) + x.foo = 42 + s = self.dumps(x, proto) + y = self.loads(s) + self.assertIs(type(y), MyIntWithNew2) + self.assertEqual(int(y), 1) + self.assertEqual(y.foo, 42) def test_newobj_not_class(self): # Issue 24552 - global SimpleNewObj - save = SimpleNewObj + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') o = SimpleNewObj.__new__(SimpleNewObj) b = self.dumps(o, 4) - try: - SimpleNewObj = 42 + with support.swap_attr(picklecommon, 'SimpleNewObj', 42): self.assertRaises((TypeError, pickle.UnpicklingError), self.loads, b) - finally: - SimpleNewObj = save # Register a type with copyreg, with extension code extcode. Pickle # an object of that type. Check that the resulting pickle uses opcode @@ -3418,14 +3429,14 @@ def test_newobj_not_class(self): def produce_global_ext(self, extcode, opcode): e = ExtensionSaver(extcode) try: - copyreg.add_extension(__name__, "MyList", extcode) + copyreg.add_extension(MyList.__module__, "MyList", extcode) x = MyList([1, 2, 3]) x.foo = 42 x.bar = "hello" # Dump using protocol 1 for comparison. s1 = self.dumps(x, 1) - self.assertIn(__name__.encode("utf-8"), s1) + self.assertIn(MyList.__module__.encode(), s1) self.assertIn(b"MyList", s1) self.assertFalse(opcode_in_pickle(opcode, s1)) @@ -3434,7 +3445,7 @@ def produce_global_ext(self, extcode, opcode): # Dump using protocol 2 for test. s2 = self.dumps(x, 2) - self.assertNotIn(__name__.encode("utf-8"), s2) + self.assertNotIn(MyList.__module__.encode(), s2) self.assertNotIn(b"MyList", s2) self.assertEqual(opcode_in_pickle(opcode, s2), True, repr(s2)) @@ -3532,14 +3543,20 @@ def test_simple_newobj(self): x.abc = 666 for proto in protocols: with self.subTest(proto=proto): + if self.py_version < (3, 0) and proto < 2: + self.skipTest('int subclasses are not interoperable with Python 2') s = self.dumps(x, proto) if proto < 1: - self.assertIn(b'\nI64206', s) # INT + if self.py_version >= (3, 7): + self.assertIn(b'\nI64206', s) # INT + else: # for test_xpickle + self.assertIn(b'64206', s) # INT or LONG else: self.assertIn(b'M\xce\xfa', s) # BININT2 - self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), - 2 <= proto) - self.assertFalse(opcode_in_pickle(pickle.NEWOBJ_EX, s)) + if not (self.py_version < (3, 5) and proto == 4): + self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), + 2 <= proto) + self.assertFalse(opcode_in_pickle(pickle.NEWOBJ_EX, s)) y = self.loads(s) # will raise TypeError if __init__ called self.assert_is_copy(x, y) @@ -3548,29 +3565,45 @@ def test_complex_newobj(self): x.abc = 666 for proto in protocols: with self.subTest(proto=proto): + if self.py_version < (3, 0) and proto < 2: + self.skipTest('int subclasses are not interoperable with Python 2') s = self.dumps(x, proto) if proto < 1: - self.assertIn(b'\nI64206', s) # INT + if self.py_version >= (3, 7): + self.assertIn(b'\nI64206', s) # INT + else: # for test_xpickle + self.assertIn(b'64206', s) # INT or LONG elif proto < 2: self.assertIn(b'M\xce\xfa', s) # BININT2 elif proto < 4: - self.assertIn(b'X\x04\x00\x00\x00FACE', s) # BINUNICODE + if self.py_version >= (3, 0): + self.assertIn(b'X\x04\x00\x00\x00FACE', s) # BINUNICODE + else: # for test_xpickle + self.assertIn(b'U\x04FACE', s) # SHORT_BINSTRING else: self.assertIn(b'\x8c\x04FACE', s) # SHORT_BINUNICODE - self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), - 2 <= proto) - self.assertFalse(opcode_in_pickle(pickle.NEWOBJ_EX, s)) + if not (self.py_version < (3, 5) and proto == 4): + self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), + 2 <= proto) + self.assertFalse(opcode_in_pickle(pickle.NEWOBJ_EX, s)) y = self.loads(s) # will raise TypeError if __init__ called self.assert_is_copy(x, y) def test_complex_newobj_ex(self): + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') x = ComplexNewObjEx.__new__(ComplexNewObjEx, 0xface) # avoid __init__ x.abc = 666 for proto in protocols: with self.subTest(proto=proto): + if self.py_version < (3, 6) and proto < 4: + self.skipTest('requires protocol 4 in Python < 3.6') s = self.dumps(x, proto) if proto < 1: - self.assertIn(b'\nI64206', s) # INT + if self.py_version >= (3, 7): + self.assertIn(b'\nI64206', s) # INT + else: # for test_xpickle + self.assertIn(b'64206', s) # INT or LONG elif proto < 2: self.assertIn(b'M\xce\xfa', s) # BININT2 elif proto < 4: @@ -3658,6 +3691,8 @@ def test_many_puts_and_gets(self): def test_attribute_name_interning(self): # Test that attribute names of pickled objects are interned when # unpickling. + if self.py_version < (3, 0): + self.skipTest('"classic" classes are not interoperable with Python 2') for proto in protocols: x = C() x.foo = 42 @@ -3687,10 +3722,14 @@ def test_large_pickles(self): dumped = self.dumps(data, proto) loaded = self.loads(dumped) self.assertEqual(len(loaded), len(data)) + if self.py_version < (3, 0): + data = (1, min, 'xy' * (30 * 1024), len) self.assertEqual(loaded, data) def test_int_pickling_efficiency(self): # Test compacity of int representation (see issue #12744) + if self.py_version < (3, 3): + self.skipTest('not supported in Python < 3.3') for proto in protocols: with self.subTest(proto=proto): pickles = [self.dumps(2**n, proto) for n in range(70)] @@ -3711,10 +3750,13 @@ def test_appends_on_non_lists(self): # Issue #17720 obj = REX_six([1, 2, 3]) for proto in protocols: - if proto == 0: - self._check_pickling_with_opcode(obj, pickle.APPEND, proto) - else: - self._check_pickling_with_opcode(obj, pickle.APPENDS, proto) + with self.subTest(proto=proto): + if proto == 0: + self._check_pickling_with_opcode(obj, pickle.APPEND, proto) + else: + if self.py_version < (3, 0): + self.skipTest('not supported in Python 2') + self._check_pickling_with_opcode(obj, pickle.APPENDS, proto) def test_setitems_on_non_dicts(self): obj = REX_seven({1: -1, 2: -2, 3: -3}) @@ -3779,6 +3821,8 @@ def check_frame_opcodes(self, pickled): @support.skip_if_pgo_task @support.requires_resource('cpu') def test_framing_many_objects(self): + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') obj = list(range(10**5)) for proto in range(4, pickle.HIGHEST_PROTOCOL + 1): with self.subTest(proto=proto): @@ -3794,6 +3838,8 @@ def test_framing_many_objects(self): self.check_frame_opcodes(pickled) def test_framing_large_objects(self): + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') N = 1024 * 1024 small_items = [[i] for i in range(10)] obj = [b'x' * N, *small_items, b'y' * N, 'z' * N] @@ -3819,15 +3865,16 @@ def test_framing_large_objects(self): [len(x) for x in unpickled]) # Perform full equality check if the lengths match. self.assertEqual(obj, unpickled) - n_frames = count_opcode(pickle.FRAME, pickled) - # A single frame for small objects between - # first two large objects. - self.assertEqual(n_frames, 1) - self.check_frame_opcodes(pickled) + if self.py_version >= (3, 7): + n_frames = count_opcode(pickle.FRAME, pickled) + # A single frame for small objects between + # first two large objects. + self.assertEqual(n_frames, 1) + self.check_frame_opcodes(pickled) def test_optional_frames(self): - if pickle.HIGHEST_PROTOCOL < 4: - return + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') def remove_frames(pickled, keep_frame=None): """Remove frame opcodes from the given pickle.""" @@ -3869,6 +3916,9 @@ def remove_frames(pickled, keep_frame=None): @support.skip_if_pgo_task def test_framed_write_sizes_with_delayed_writer(self): + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') + class ChunkAccumulator: """Accumulate pickler output in a list of raw chunks.""" def __init__(self): @@ -3934,13 +3984,12 @@ def concatenate_chunks(self): chunk_sizes) def test_nested_names(self): - global Nested - class Nested: - class A: - class B: - class C: - pass + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') + # required protocol 4 in Python 3.4 for proto in range(pickle.HIGHEST_PROTOCOL + 1): + if self.py_version < (3, 5) and proto < 4: + continue for obj in [Nested.A, Nested.A.B, Nested.A.B.C]: with self.subTest(proto=proto, obj=obj): unpickled = self.loads(self.dumps(obj, proto)) @@ -3971,35 +4020,21 @@ class Recursive: del Recursive.ref # break reference loop def test_py_methods(self): - global PyMethodsTest - class PyMethodsTest: - @staticmethod - def cheese(): - return "cheese" - @classmethod - def wine(cls): - assert cls is PyMethodsTest - return "wine" - def biscuits(self): - assert isinstance(self, PyMethodsTest) - return "biscuits" - class Nested: - "Nested class" - @staticmethod - def ketchup(): - return "ketchup" - @classmethod - def maple(cls): - assert cls is PyMethodsTest.Nested - return "maple" - def pie(self): - assert isinstance(self, PyMethodsTest.Nested) - return "pie" - + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') py_methods = ( - PyMethodsTest.cheese, PyMethodsTest.wine, PyMethodsTest().biscuits, + ) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + for method in py_methods: + with self.subTest(proto=proto, method=method): + unpickled = self.loads(self.dumps(method, proto)) + self.assertEqual(method(), unpickled()) + + # required protocol 4 in Python 3.4 + py_methods = ( + PyMethodsTest.cheese, PyMethodsTest.Nested.ketchup, PyMethodsTest.Nested.maple, PyMethodsTest.Nested().pie @@ -4009,6 +4044,8 @@ def pie(self): (PyMethodsTest.Nested.pie, PyMethodsTest.Nested) ) for proto in range(pickle.HIGHEST_PROTOCOL + 1): + if self.py_version < (3, 5) and proto < 4: + continue for method in py_methods: with self.subTest(proto=proto, method=method): unpickled = self.loads(self.dumps(method, proto)) @@ -4029,11 +4066,8 @@ def pie(self): self.assertRaises(TypeError, self.dumps, descr, proto) def test_c_methods(self): - global Subclass - class Subclass(tuple): - class Nested(str): - pass - + if self.py_version < (3, 4): + self.skipTest('not supported in Python < 3.4') c_methods = ( # bound built-in method ("abcd".index, ("c",)), @@ -4054,7 +4088,6 @@ class Nested(str): # subclass methods (Subclass([1,2,2]).count, (2,)), (Subclass.count, (Subclass([1,2,2]), 2)), - (Subclass.Nested("sweet").count, ("e",)), (Subclass.Nested.count, (Subclass.Nested("sweet"), "e")), ) for proto in range(pickle.HIGHEST_PROTOCOL + 1): @@ -4063,6 +4096,18 @@ class Nested(str): unpickled = self.loads(self.dumps(method, proto)) self.assertEqual(method(*args), unpickled(*args)) + # required protocol 4 in Python 3.4 + c_methods = ( + (Subclass.Nested("sweet").count, ("e",)), + ) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + if self.py_version < (3, 5) and proto < 4: + continue + for method, args in c_methods: + with self.subTest(proto=proto, method=method): + unpickled = self.loads(self.dumps(method, proto)) + self.assertEqual(method(*args), unpickled(*args)) + descriptors = ( bytearray.__dict__['maketrans'], # built-in static method descriptor dict.__dict__['fromkeys'], # built-in class method descriptor @@ -4073,6 +4118,8 @@ class Nested(str): self.assertRaises(TypeError, self.dumps, descr, proto) def test_compat_pickle(self): + if self.py_version < (3, 4): + self.skipTest("doesn't work in Python < 3.4'") tests = [ (range(1, 7), '__builtin__', 'xrange'), (map(int, '123'), 'itertools', 'imap'), @@ -4448,110 +4495,6 @@ def test_huge_str_64b(self, size): data = None -# Test classes for reduce_ex - -class R: - def __init__(self, reduce=None): - self.reduce = reduce - def __reduce__(self, proto): - return self.reduce - -class REX: - def __init__(self, reduce_ex=None): - self.reduce_ex = reduce_ex - def __reduce_ex__(self, proto): - return self.reduce_ex - -class REX_one(object): - """No __reduce_ex__ here, but inheriting it from object""" - _reduce_called = 0 - def __reduce__(self): - self._reduce_called = 1 - return REX_one, () - -class REX_two(object): - """No __reduce__ here, but inheriting it from object""" - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return REX_two, () - -class REX_three(object): - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return REX_two, () - def __reduce__(self): - raise TestFailed("This __reduce__ shouldn't be called") - -class REX_four(object): - """Calling base class method should succeed""" - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return object.__reduce_ex__(self, proto) - -class REX_five(object): - """This one used to fail with infinite recursion""" - _reduce_called = 0 - def __reduce__(self): - self._reduce_called = 1 - return object.__reduce__(self) - -class REX_six(object): - """This class is used to check the 4th argument (list iterator) of - the reduce protocol. - """ - def __init__(self, items=None): - self.items = items if items is not None else [] - def __eq__(self, other): - return type(self) is type(other) and self.items == other.items - def append(self, item): - self.items.append(item) - def __reduce__(self): - return type(self), (), None, iter(self.items), None - -class REX_seven(object): - """This class is used to check the 5th argument (dict iterator) of - the reduce protocol. - """ - def __init__(self, table=None): - self.table = table if table is not None else {} - def __eq__(self, other): - return type(self) is type(other) and self.table == other.table - def __setitem__(self, key, value): - self.table[key] = value - def __reduce__(self): - return type(self), (), None, None, iter(self.table.items()) - -class REX_state(object): - """This class is used to check the 3th argument (state) of - the reduce protocol. - """ - def __init__(self, state=None): - self.state = state - def __eq__(self, other): - return type(self) is type(other) and self.state == other.state - def __setstate__(self, state): - self.state = state - def __reduce__(self): - return type(self), (), self.state - -class REX_None: - """ Setting __reduce_ex__ to None should fail """ - __reduce_ex__ = None - -class R_None: - """ Setting __reduce__ to None should fail """ - __reduce__ = None - -class C_None_setstate: - """ Setting __setstate__ to None should fail """ - def __getstate__(self): - return 1 - - __setstate__ = None - class CustomError(Exception): pass @@ -4561,80 +4504,17 @@ def __reduce__(self): UNPICKLEABLE = Unpickleable() +# For test_unpickleable_reconstructor and test_unpickleable_state_setter class UnpickleableCallable(Unpickleable): def __call__(self, *args, **kwargs): pass - -# Test classes for newobj - -class MyInt(int): - sample = 1 - -class MyFloat(float): - sample = 1.0 - -class MyComplex(complex): - sample = 1.0 + 0.0j - -class MyStr(str): - sample = "hello" - -class MyUnicode(str): - sample = "hello \u1234" - -class MyTuple(tuple): - sample = (1, 2, 3) - -class MyList(list): - sample = [1, 2, 3] - -class MyDict(dict): - sample = {"a": 1, "b": 2} - -class MySet(set): - sample = {"a", "b"} - -class MyFrozenSet(frozenset): - sample = frozenset({"a", "b"}) - -myclasses = [MyInt, MyFloat, - MyComplex, - MyStr, MyUnicode, - MyTuple, MyList, MyDict, MySet, MyFrozenSet] - -class MyIntWithNew(int): - def __new__(cls, value): - raise AssertionError - -class MyIntWithNew2(MyIntWithNew): - __new__ = int.__new__ - - -class SlotList(MyList): - __slots__ = ["foo"] - -# Ruff "redefined while unused" false positive here due to `global` variables -# being assigned (and then restored) from within test methods earlier in the file -class SimpleNewObj(int): # noqa: F811 - def __init__(self, *args, **kwargs): - # raise an error, to make sure this isn't called - raise TypeError("SimpleNewObj.__init__() didn't expect to get called") - def __eq__(self, other): - return int(self) == int(other) and self.__dict__ == other.__dict__ - -class ComplexNewObj(SimpleNewObj): - def __getnewargs__(self): - return ('%X' % self, 16) - -class ComplexNewObjEx(SimpleNewObj): - def __getnewargs_ex__(self): - return ('%X' % self,), {'base': 16} - +# For test_bad_getattr class BadGetattr: def __getattr__(self, key): self.foo +# For test_bad_newobj_class and test_bad_newobj_ex__class class NoNew: def __getattribute__(self, name): if name == '__new__': diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py index 19d9ea9eab289f..4f092beeea179b 100644 --- a/Lib/test/test_capi/test_opt.py +++ b/Lib/test/test_capi/test_opt.py @@ -1168,22 +1168,6 @@ def testfunc(n): self.assertIsNotNone(ex) self.assertIn("_FOR_ITER_TIER_TWO", get_opnames(ex)) - @unittest.skip("Tracing into generators currently isn't supported.") - def test_for_iter_gen(self): - def gen(n): - for i in range(n): - yield i - def testfunc(n): - g = gen(n) - s = 0 - for i in g: - s += i - return s - res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD) - self.assertEqual(res, sum(range(TIER2_THRESHOLD))) - self.assertIsNotNone(ex) - self.assertIn("_FOR_ITER_GEN_FRAME", get_opnames(ex)) - def test_modified_local_is_seen_by_optimized_code(self): l = sys._getframe().f_locals a = 1 @@ -2935,6 +2919,25 @@ def testfunc(n): self.assertLessEqual(count_ops(ex, "_POP_TOP"), 1) self.assertIn("_POP_TOP_NOP", uops) + def test_to_bool_always_true(self): + def testfunc(n): + class A: + pass + + a = A() + for _ in range(n): + if not a: + return 0 + return 1 + + res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD) + self.assertEqual(res, 1) + self.assertIsNotNone(ex) + uops = get_opnames(ex) + self.assertNotIn("_REPLACE_WITH_TRUE", uops) + self.assertIn("_INSERT_1_LOAD_CONST_INLINE_BORROW", uops) + self.assertEqual(count_ops(ex, "_POP_TOP_NOP"), 1) + def test_attr_promotion_failure(self): # We're not testing for any specific uops here, just # testing it doesn't crash. @@ -3385,6 +3388,47 @@ def test_is_none(n): self.assertIn("_POP_TOP_NOP", uops) self.assertLessEqual(count_ops(ex, "_POP_TOP"), 2) + def test_for_iter_gen_frame(self): + def f(n): + for i in range(n): + # Should be optimized to POP_TOP_NOP + yield i + i + def testfunc(n): + for _ in f(n): + pass + + res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD*2) + self.assertIsNotNone(ex) + uops = get_opnames(ex) + + self.assertIn("_FOR_ITER_GEN_FRAME", uops) + # _POP_TOP_NOP is a sign the optimizer ran and didn't hit bottom. + self.assertGreaterEqual(count_ops(ex, "_POP_TOP_NOP"), 1) + + def test_send_gen_frame(self): + + def gen(n): + for i in range(n): + yield i + i + def send_gen(n): + yield from gen(n) + def testfunc(n): + for _ in send_gen(n): + pass + + for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD): + # Ensure SEND is specialized to SEND_GEN + send_gen(10) + + res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD*2) + self.assertIsNotNone(ex) + uops = get_opnames(ex) + + self.assertIn("_FOR_ITER_GEN_FRAME", uops) + self.assertIn("_SEND_GEN_FRAME", uops) + # _POP_TOP_NOP is a sign the optimizer ran and didn't hit bottom. + self.assertGreaterEqual(count_ops(ex, "_POP_TOP_NOP"), 1) + def test_143026(self): # https://github.com/python/cpython/issues/143026 diff --git a/Lib/test/test_opcache.py b/Lib/test/test_opcache.py index be9b52b8bc45e2..0344f08faecce7 100644 --- a/Lib/test/test_opcache.py +++ b/Lib/test/test_opcache.py @@ -1909,6 +1909,44 @@ class MyList(list): pass self.assert_no_opcode(my_list_append, "CALL_LIST_APPEND") self.assert_no_opcode(my_list_append, "CALL") + @cpython_only + @requires_specialization_ft + def test_load_attr_module_with_getattr(self): + module = types.ModuleType("test_module_with_getattr") + module.__dict__["some_attr"] = "foo" + + def module_getattr(name): + if name == "missing_attr": + return 42 + raise AttributeError(f"module has no attribute {name}") + + module.__dict__["__getattr__"] = module_getattr + + import sys + sys.modules.pop("test_module_with_getattr", None) + sys.modules["test_module_with_getattr"] = module + try: + def load_module_attr_present(): + import test_module_with_getattr + return test_module_with_getattr.some_attr + + for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD): + self.assertEqual(load_module_attr_present(), "foo") + + self.assert_specialized(load_module_attr_present, "LOAD_ATTR_MODULE") + self.assert_no_opcode(load_module_attr_present, "LOAD_ATTR") + + def load_module_attr_missing(): + import test_module_with_getattr + return test_module_with_getattr.missing_attr + + for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD): + self.assertEqual(load_module_attr_missing(), 42) + + self.assert_no_opcode(load_module_attr_missing, "LOAD_ATTR_MODULE") + finally: + sys.modules.pop("test_module_with_getattr", None) + if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_xpickle.py b/Lib/test/test_xpickle.py new file mode 100644 index 00000000000000..459944afd20ef7 --- /dev/null +++ b/Lib/test/test_xpickle.py @@ -0,0 +1,240 @@ +# This test covers backwards compatibility with previous versions of Python +# by bouncing pickled objects through Python versions by running xpickle_worker.py. +import io +import os +import pickle +import subprocess +import sys +import unittest + + +from test import support +from test import pickletester + +try: + import _pickle + has_c_implementation = True +except ModuleNotFoundError: + has_c_implementation = False + +is_windows = sys.platform.startswith('win') + +# Map python version to a tuple containing the name of a corresponding valid +# Python binary to execute and its arguments. +py_executable_map = {} + +protocols_map = { + 3: (3, 0), + 4: (3, 4), + 5: (3, 8), +} + +def highest_proto_for_py_version(py_version): + """Finds the highest supported pickle protocol for a given Python version. + Args: + py_version: a 2-tuple of the major, minor version. Eg. Python 3.7 would + be (3, 7) + Returns: + int for the highest supported pickle protocol + """ + proto = 2 + for p, v in protocols_map.items(): + if py_version < v: + break + proto = p + return proto + +def have_python_version(py_version): + """Check whether a Python binary exists for the given py_version and has + support. This respects your PATH. + For Windows, it will first try to use the py launcher specified in PEP 397. + Otherwise (and for all other platforms), it will attempt to check for + python.. + + Eg. given a *py_version* of (3, 7), the function will attempt to try + 'py -3.7' (for Windows) first, then 'python3.7', and return + ['py', '-3.7'] (on Windows) or ['python3.7'] on other platforms. + + Args: + py_version: a 2-tuple of the major, minor version. Eg. python 3.7 would + be (3, 7) + Returns: + List/Tuple containing the Python binary name and its required arguments, + or None if no valid binary names found. + """ + python_str = ".".join(map(str, py_version)) + targets = [('py', f'-{python_str}'), (f'python{python_str}',)] + if py_version not in py_executable_map: + for target in targets[0 if is_windows else 1:]: + try: + worker = subprocess.Popen([*target, '-c', 'pass'], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + shell=is_windows) + worker.communicate() + if worker.returncode == 0: + py_executable_map[py_version] = target + break + except FileNotFoundError: + pass + + return py_executable_map.get(py_version, None) + + +@support.requires_resource('cpu') +class AbstractCompatTests(pickletester.AbstractPickleTests): + py_version = None + + @classmethod + def setUpClass(cls): + assert cls.py_version is not None, 'Needs a python version tuple' + if not have_python_version(cls.py_version): + py_version_str = ".".join(map(str, cls.py_version)) + raise unittest.SkipTest(f'Python {py_version_str} not available') + # Override the default pickle protocol to match what xpickle worker + # will be running. + highest_protocol = highest_proto_for_py_version(cls.py_version) + cls.enterClassContext(support.swap_attr(pickletester, 'protocols', + range(highest_protocol + 1))) + cls.enterClassContext(support.swap_attr(pickle, 'HIGHEST_PROTOCOL', + highest_protocol)) + + @staticmethod + def send_to_worker(python, data): + """Bounce a pickled object through another version of Python. + This will send data to a child process where it will + be unpickled, then repickled and sent back to the parent process. + Args: + python: list containing the python binary to start and its arguments + data: bytes object to send to the child process + Returns: + The pickled data received from the child process. + """ + target = os.path.join(os.path.dirname(__file__), 'xpickle_worker.py') + worker = subprocess.Popen([*python, target], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + # For windows bpo-17023. + shell=is_windows) + stdout, stderr = worker.communicate(data) + if worker.returncode == 0: + return stdout + # if the worker fails, it will write the exception to stdout + try: + exception = pickle.loads(stdout) + except (pickle.UnpicklingError, EOFError): + raise RuntimeError(stderr) + else: + if support.verbose > 1: + print() + print(f'{data = }') + print(f'{stdout = }') + print(f'{stderr = }') + if isinstance(exception, Exception): + # To allow for tests which test for errors. + raise exception + else: + raise RuntimeError(stderr) + + + def dumps(self, arg, proto=0, **kwargs): + # Skip tests that require buffer_callback arguments since + # there isn't a reliable way to marshal/pickle the callback and ensure + # it works in a different Python version. + if 'buffer_callback' in kwargs: + self.skipTest('Test does not support "buffer_callback" argument.') + f = io.BytesIO() + p = self.pickler(f, proto, **kwargs) + p.dump((proto, arg)) + f.seek(0) + data = bytes(f.read()) + python = py_executable_map[self.py_version] + return self.send_to_worker(python, data) + + def loads(self, buf, **kwds): + f = io.BytesIO(buf) + u = self.unpickler(f, **kwds) + return u.load() + + # A scaled-down version of test_bytes from pickletester, to reduce + # the number of calls to self.dumps() and hence reduce the number of + # child python processes forked. This allows the test to complete + # much faster (the one from pickletester takes 3-4 minutes when running + # under text_xpickle). + def test_bytes(self): + if self.py_version < (3, 0): + self.skipTest('not supported in Python < 3.0') + for proto in pickletester.protocols: + for s in b'', b'xyz', b'xyz'*100: + p = self.dumps(s, proto) + self.assert_is_copy(s, self.loads(p)) + s = bytes(range(256)) + p = self.dumps(s, proto) + self.assert_is_copy(s, self.loads(p)) + s = bytes([i for i in range(256) for _ in range(2)]) + p = self.dumps(s, proto) + self.assert_is_copy(s, self.loads(p)) + + # These tests are disabled because they require some special setup + # on the worker that's hard to keep in sync. + test_global_ext1 = None + test_global_ext2 = None + test_global_ext4 = None + + # These tests fail because they require classes from pickletester + # which cannot be properly imported by the xpickle worker. + test_recursive_nested_names = None + test_recursive_nested_names2 = None + + # Attribute lookup problems are expected, disable the test + test_dynamic_class = None + test_evil_class_mutating_dict = None + + # Expected exception is raised during unpickling in a subprocess. + test_pickle_setstate_None = None + + # Other Python version may not have NumPy. + test_buffers_numpy = None + + # Skip tests that require buffer_callback arguments since + # there isn't a reliable way to marshal/pickle the callback and ensure + # it works in a different Python version. + test_in_band_buffers = None + test_buffers_error = None + test_oob_buffers = None + test_oob_buffers_writable_to_readonly = None + +class PyPicklePythonCompat(AbstractCompatTests): + pickler = pickle._Pickler + unpickler = pickle._Unpickler + +if has_c_implementation: + class CPicklePythonCompat(AbstractCompatTests): + pickler = _pickle.Pickler + unpickler = _pickle.Unpickler + + +def make_test(py_version, base): + class_dict = {'py_version': py_version} + name = base.__name__.replace('Python', 'Python%d%d' % py_version) + return type(name, (base, unittest.TestCase), class_dict) + +def load_tests(loader, tests, pattern): + def add_tests(py_version): + test_class = make_test(py_version, PyPicklePythonCompat) + tests.addTest(loader.loadTestsFromTestCase(test_class)) + if has_c_implementation: + test_class = make_test(py_version, CPicklePythonCompat) + tests.addTest(loader.loadTestsFromTestCase(test_class)) + + major = sys.version_info.major + assert major == 3 + add_tests((2, 7)) + for minor in range(2, sys.version_info.minor): + add_tests((major, minor)) + return tests + + +if __name__ == '__main__': + unittest.main() diff --git a/Lib/test/xpickle_worker.py b/Lib/test/xpickle_worker.py new file mode 100644 index 00000000000000..03191372bf7ac8 --- /dev/null +++ b/Lib/test/xpickle_worker.py @@ -0,0 +1,38 @@ +# This script is called by test_xpickle as a subprocess to load and dump +# pickles in a different Python version. +import os +import pickle +import sys + + +# This allows the xpickle worker to import picklecommon.py, which it needs +# since some of the pickle objects hold references to picklecommon.py. +test_mod_path = os.path.abspath(os.path.join(os.path.dirname(__file__), + 'picklecommon.py')) +if sys.version_info >= (3, 5): + import importlib.util + spec = importlib.util.spec_from_file_location('test.picklecommon', test_mod_path) + test_module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(test_module) + sys.modules['test.picklecommon'] = test_module +else: + test_module = type(sys)('test.picklecommon') + sys.modules['test.picklecommon'] = test_module + sys.modules['test'] = type(sys)('test') + with open(test_mod_path, 'rb') as f: + sources = f.read() + exec(sources, vars(test_module)) + + +in_stream = getattr(sys.stdin, 'buffer', sys.stdin) +out_stream = getattr(sys.stdout, 'buffer', sys.stdout) + +try: + message = pickle.load(in_stream) + protocol, obj = message + pickle.dump(obj, out_stream, protocol) +except Exception as e: + # dump the exception to stdout and write to stderr, then exit + pickle.dump(e, out_stream) + sys.stderr.write(repr(e)) + sys.exit(1) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-01-01-23-41-50.gh-issue-131798.QUqDdK.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-01-23-41-50.gh-issue-131798.QUqDdK.rst new file mode 100644 index 00000000000000..528eb70433576e --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-01-23-41-50.gh-issue-131798.QUqDdK.rst @@ -0,0 +1 @@ +The JIT optimizer now understands more generator instructions. diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-01-06-12-30-03.gh-issue-143469.vHVhEY.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-06-12-30-03.gh-issue-143469.vHVhEY.rst new file mode 100644 index 00000000000000..9bac54497f8998 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-06-12-30-03.gh-issue-143469.vHVhEY.rst @@ -0,0 +1 @@ +Enable :opcode:`!LOAD_ATTR_MODULE` specialization even if :func:`!__getattr__` is defined in module. diff --git a/Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst b/Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst new file mode 100644 index 00000000000000..2c76bb4f2bcff9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-20-10-21-23.gh-issue-142991.jYHD9E.rst @@ -0,0 +1,2 @@ +Fixed socket operations such as recvfrom() and sendto() for FreeBSD +divert(4) socket. diff --git a/Misc/NEWS.d/next/Library/2026-01-06-12-00-00.gh-issue-143474.cQM4VA.rst b/Misc/NEWS.d/next/Library/2026-01-06-12-00-00.gh-issue-143474.cQM4VA.rst new file mode 100644 index 00000000000000..b3aa69f80aa913 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-01-06-12-00-00.gh-issue-143474.cQM4VA.rst @@ -0,0 +1 @@ +Add :data:`os.RWF_ATOMIC` constant for Linux 6.11+. diff --git a/Misc/NEWS.d/next/Tests/2020-09-29-23-14-01.bpo-31391.IZr2P8.rst b/Misc/NEWS.d/next/Tests/2020-09-29-23-14-01.bpo-31391.IZr2P8.rst new file mode 100644 index 00000000000000..60b7fdc8066318 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2020-09-29-23-14-01.bpo-31391.IZr2P8.rst @@ -0,0 +1,2 @@ +Forward-port test_xpickle from Python 2 to Python 3 and add the resource +back to test's command line. diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index e183c70653b0d4..33e624e342eaee 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -3764,7 +3764,8 @@ _decimal_Decimal___format___impl(PyObject *dec, PyTypeObject *cls, if (size > 0 && fmt[size-1] == 'N') { if (PyErr_WarnEx(PyExc_DeprecationWarning, - "Format specifier 'N' is deprecated", 1) < 0) { + "Format specifier 'N' is deprecated and " + "slated for removal in Python 3.18", 1) < 0) { return NULL; } } diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index d880fc52bb370d..03c0f221ba98b3 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -8692,6 +8692,7 @@ PyDoc_STRVAR(os_pwritev__doc__, "- RWF_SYNC\n" "- RWF_APPEND\n" "- RWF_DONTCACHE\n" +"- RWF_ATOMIC\n" "\n" "Using non-zero flags requires Linux 4.7 or newer."); @@ -13610,4 +13611,4 @@ os__emscripten_log(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py #ifndef OS__EMSCRIPTEN_LOG_METHODDEF #define OS__EMSCRIPTEN_LOG_METHODDEF #endif /* !defined(OS__EMSCRIPTEN_LOG_METHODDEF) */ -/*[clinic end generated code: output=82f60940338c70e4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5fd2aeb6ba9a5df8 input=a9049054013a1b77]*/ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index b26785abc3cd27..49214d57a2e362 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -12863,6 +12863,7 @@ The flags argument contains a bitwise OR of zero or more of the following flags: - RWF_SYNC - RWF_APPEND - RWF_DONTCACHE +- RWF_ATOMIC Using non-zero flags requires Linux 4.7 or newer. [clinic start generated code]*/ @@ -12870,7 +12871,7 @@ Using non-zero flags requires Linux 4.7 or newer. static Py_ssize_t os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset, int flags) -/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=664a67626d485665]*/ +/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=7de72245873f56bf]*/ { Py_ssize_t cnt; Py_ssize_t result; @@ -18120,6 +18121,9 @@ all_ins(PyObject *m) #ifdef RWF_DONTCACHE if (PyModule_AddIntConstant(m, "RWF_DONTCACHE", RWF_DONTCACHE)) return -1; #endif +#ifdef RWF_ATOMIC + if (PyModule_AddIntConstant(m, "RWF_ATOMIC", RWF_ATOMIC)) return -1; +#endif #ifdef RWF_APPEND if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1; #endif diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 1ef359cb265ed4..ee78ad01598262 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2769,6 +2769,12 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret) _Py_FALLTHROUGH; #endif /* AF_RDS */ +#ifdef AF_DIVERT + case AF_DIVERT: + /* FreeBSD divert(4) sockets use sockaddr_in: fall-through */ + _Py_FALLTHROUGH; +#endif /* AF_DIVERT */ + case AF_INET: { *len_ret = sizeof (struct sockaddr_in); diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 9a43057b383d29..ca6f323ac11fbc 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -25,14 +25,6 @@ class BaseExceptionGroup "PyBaseExceptionGroupObject *" "&PyExc_BaseExceptionGro /*[clinic end generated code: output=da39a3ee5e6b4b0d input=b7c45e78cff8edc3]*/ -/* Compatibility aliases */ -PyObject *PyExc_EnvironmentError = NULL; // borrowed ref -PyObject *PyExc_IOError = NULL; // borrowed ref -#ifdef MS_WINDOWS -PyObject *PyExc_WindowsError = NULL; // borrowed ref -#endif - - static struct _Py_exc_state* get_exc_state(void) { @@ -2528,6 +2520,13 @@ MiddlingExtendsException(PyExc_OSError, ProcessLookupError, OSError, MiddlingExtendsException(PyExc_OSError, TimeoutError, OSError, "Timeout expired."); +/* Compatibility aliases */ +PyObject *PyExc_EnvironmentError = (PyObject *)&_PyExc_OSError; // borrowed ref +PyObject *PyExc_IOError = (PyObject *)&_PyExc_OSError; // borrowed ref +#ifdef MS_WINDOWS +PyObject *PyExc_WindowsError = (PyObject *)&_PyExc_OSError; // borrowed ref +#endif + /* * EOFError extends Exception */ @@ -4599,23 +4598,17 @@ _PyBuiltins_AddExceptions(PyObject *bltinmod) if (PyDict_SetItemString(mod_dict, "ExceptionGroup", PyExc_ExceptionGroup)) { return -1; } - -#define INIT_ALIAS(NAME, TYPE) \ - do { \ - PyExc_ ## NAME = PyExc_ ## TYPE; \ - if (PyDict_SetItemString(mod_dict, # NAME, PyExc_ ## TYPE)) { \ - return -1; \ - } \ - } while (0) - - INIT_ALIAS(EnvironmentError, OSError); - INIT_ALIAS(IOError, OSError); + if (PyDict_SetItemString(mod_dict, "EnvironmentError", PyExc_OSError)) { + return -1; + } + if (PyDict_SetItemString(mod_dict, "IOError", PyExc_OSError)) { + return -1; + } #ifdef MS_WINDOWS - INIT_ALIAS(WindowsError, OSError); + if (PyDict_SetItemString(mod_dict, "WindowsError", PyExc_OSError)) { + return -1; + } #endif - -#undef INIT_ALIAS - return 0; } diff --git a/Python/bytecodes.c b/Python/bytecodes.c index a7213d82a68ba4..f5586400402cfe 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -565,15 +565,17 @@ dummy_func( macro(TO_BOOL_STR) = _GUARD_TOS_UNICODE + unused/1 + unused/2 + _TO_BOOL_STR; - op(_REPLACE_WITH_TRUE, (value -- res)) { - PyStackRef_CLOSE(value); + op(_REPLACE_WITH_TRUE, (value -- res, v)) { res = PyStackRef_True; + v = value; + DEAD(value); } macro(TO_BOOL_ALWAYS_TRUE) = unused/1 + _GUARD_TYPE_VERSION + - _REPLACE_WITH_TRUE; + _REPLACE_WITH_TRUE + + POP_TOP; inst(UNARY_INVERT, (value -- res)) { PyObject *res_o = PyNumber_Invert(PyStackRef_AsPyObjectBorrow(value)); @@ -5309,6 +5311,12 @@ dummy_func( value = PyStackRef_FromPyObjectBorrow(ptr); } + tier2 op(_INSERT_1_LOAD_CONST_INLINE_BORROW, (ptr/4, left -- res, l)) { + res = PyStackRef_FromPyObjectBorrow(ptr); + l = left; + INPUTS_DEAD(); + } + tier2 op(_SHUFFLE_2_LOAD_CONST_INLINE_BORROW, (ptr/4, callable, null, arg -- res, a)) { res = PyStackRef_FromPyObjectBorrow(ptr); a = arg; diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 05b8c2d797a8ea..4ba6f7cfeee1f3 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -3581,21 +3581,56 @@ break; } - case _REPLACE_WITH_TRUE_r11: { + case _REPLACE_WITH_TRUE_r02: { + CHECK_CURRENT_CACHED_VALUES(0); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + _PyStackRef value; + _PyStackRef res; + _PyStackRef v; + value = stack_pointer[-1]; + res = PyStackRef_True; + v = value; + _tos_cache1 = v; + _tos_cache0 = res; + SET_CURRENT_CACHED_VALUES(2); + stack_pointer += -1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + break; + } + + case _REPLACE_WITH_TRUE_r12: { CHECK_CURRENT_CACHED_VALUES(1); assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); _PyStackRef value; _PyStackRef res; + _PyStackRef v; _PyStackRef _stack_item_0 = _tos_cache0; value = _stack_item_0; - _PyFrame_SetStackPointer(frame, stack_pointer); - PyStackRef_CLOSE(value); - stack_pointer = _PyFrame_GetStackPointer(frame); res = PyStackRef_True; + v = value; + _tos_cache1 = v; _tos_cache0 = res; - _tos_cache1 = PyStackRef_ZERO_BITS; - _tos_cache2 = PyStackRef_ZERO_BITS; - SET_CURRENT_CACHED_VALUES(1); + SET_CURRENT_CACHED_VALUES(2); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + break; + } + + case _REPLACE_WITH_TRUE_r23: { + CHECK_CURRENT_CACHED_VALUES(2); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + _PyStackRef value; + _PyStackRef res; + _PyStackRef v; + _PyStackRef _stack_item_0 = _tos_cache0; + _PyStackRef _stack_item_1 = _tos_cache1; + value = _stack_item_1; + res = PyStackRef_True; + v = value; + _tos_cache2 = v; + _tos_cache1 = res; + _tos_cache0 = _stack_item_0; + SET_CURRENT_CACHED_VALUES(3); assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); break; } @@ -17591,6 +17626,63 @@ break; } + case _INSERT_1_LOAD_CONST_INLINE_BORROW_r02: { + CHECK_CURRENT_CACHED_VALUES(0); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + _PyStackRef left; + _PyStackRef res; + _PyStackRef l; + left = stack_pointer[-1]; + PyObject *ptr = (PyObject *)CURRENT_OPERAND0_64(); + res = PyStackRef_FromPyObjectBorrow(ptr); + l = left; + _tos_cache1 = l; + _tos_cache0 = res; + SET_CURRENT_CACHED_VALUES(2); + stack_pointer += -1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + break; + } + + case _INSERT_1_LOAD_CONST_INLINE_BORROW_r12: { + CHECK_CURRENT_CACHED_VALUES(1); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + _PyStackRef left; + _PyStackRef res; + _PyStackRef l; + _PyStackRef _stack_item_0 = _tos_cache0; + left = _stack_item_0; + PyObject *ptr = (PyObject *)CURRENT_OPERAND0_64(); + res = PyStackRef_FromPyObjectBorrow(ptr); + l = left; + _tos_cache1 = l; + _tos_cache0 = res; + SET_CURRENT_CACHED_VALUES(2); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + break; + } + + case _INSERT_1_LOAD_CONST_INLINE_BORROW_r23: { + CHECK_CURRENT_CACHED_VALUES(2); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + _PyStackRef left; + _PyStackRef res; + _PyStackRef l; + _PyStackRef _stack_item_0 = _tos_cache0; + _PyStackRef _stack_item_1 = _tos_cache1; + left = _stack_item_1; + PyObject *ptr = (PyObject *)CURRENT_OPERAND0_64(); + res = PyStackRef_FromPyObjectBorrow(ptr); + l = left; + _tos_cache2 = l; + _tos_cache1 = res; + _tos_cache0 = _stack_item_0; + SET_CURRENT_CACHED_VALUES(3); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + break; + } + case _SHUFFLE_2_LOAD_CONST_INLINE_BORROW_r02: { CHECK_CURRENT_CACHED_VALUES(0); assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 2c19acd8be5ef0..8ad62cd9a1e813 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -11335,6 +11335,7 @@ _PyStackRef owner; _PyStackRef value; _PyStackRef res; + _PyStackRef v; /* Skip 1 cache entry */ // _GUARD_TYPE_VERSION { @@ -11351,16 +11352,17 @@ // _REPLACE_WITH_TRUE { value = owner; - stack_pointer += -1; - ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + res = PyStackRef_True; + v = value; + } + // _POP_TOP + { + value = v; + stack_pointer[-1] = res; _PyFrame_SetStackPointer(frame, stack_pointer); - PyStackRef_CLOSE(value); + PyStackRef_XCLOSE(value); stack_pointer = _PyFrame_GetStackPointer(frame); - res = PyStackRef_True; } - stack_pointer[0] = res; - stack_pointer += 1; - ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); DISPATCH(); } diff --git a/Python/lock.c b/Python/lock.c index 789065d8162792..12b5ebc89aeec7 100644 --- a/Python/lock.c +++ b/Python/lock.c @@ -124,8 +124,11 @@ _PyMutex_LockTimed(PyMutex *m, PyTime_t timeout, _PyLockFlags flags) &entry, (flags & _PY_LOCK_DETACH) != 0); if (ret == Py_PARK_OK) { if (entry.handed_off) { - // We own the lock now. - assert(_Py_atomic_load_uint8_relaxed(&m->_bits) & _Py_LOCKED); + // We own the lock now. thread.Lock allows other threads + // to concurrently release the lock so we cannot assert that + // it is locked if _PY_LOCK_PYTHONLOCK is set. + assert(_Py_atomic_load_uint8_relaxed(&m->_bits) & _Py_LOCKED || + (flags & _PY_LOCK_PYTHONLOCK) != 0); return PY_LOCK_ACQUIRED; } } diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index e92eb2b75a291a..cbcae5075a279d 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -939,15 +939,35 @@ dummy_func(void) { } op(_FOR_ITER_GEN_FRAME, (unused, unused -- unused, unused, gen_frame)) { - gen_frame = PyJitRef_NULL; - /* We are about to hit the end of the trace */ - ctx->done = true; + assert((this_instr + 1)->opcode == _PUSH_FRAME); + PyCodeObject *co = get_code_with_logging((this_instr + 1)); + if (co == NULL) { + ctx->done = true; + break; + } + _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + if (new_frame == NULL) { + ctx->done = true; + break; + } + new_frame->stack[0] = sym_new_const(ctx, Py_None); + gen_frame = PyJitRef_Wrap((JitOptSymbol *)new_frame); } - op(_SEND_GEN_FRAME, (unused, unused -- unused, gen_frame)) { - gen_frame = PyJitRef_NULL; - // We are about to hit the end of the trace: - ctx->done = true; + op(_SEND_GEN_FRAME, (unused, v -- unused, gen_frame)) { + assert((this_instr + 1)->opcode == _PUSH_FRAME); + PyCodeObject *co = get_code_with_logging((this_instr + 1)); + if (co == NULL) { + ctx->done = true; + break; + } + _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + if (new_frame == NULL) { + ctx->done = true; + break; + } + new_frame->stack[0] = PyJitRef_StripReferenceInfo(v); + gen_frame = PyJitRef_Wrap((JitOptSymbol *)new_frame); } op(_CHECK_STACK_SPACE, (unused, unused, unused[oparg] -- unused, unused, unused[oparg])) { @@ -1171,9 +1191,10 @@ dummy_func(void) { ctx->done = true; } - op(_REPLACE_WITH_TRUE, (value -- res)) { - REPLACE_OP(this_instr, _POP_TOP_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)Py_True); + op(_REPLACE_WITH_TRUE, (value -- res, v)) { + REPLACE_OP(this_instr, _INSERT_1_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)Py_True); res = sym_new_const(ctx, Py_True); + v = value; } op(_BUILD_TUPLE, (values[oparg] -- tup)) { diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index 52360f8119df4c..96aee7830b9e24 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -420,10 +420,18 @@ } case _REPLACE_WITH_TRUE: { + JitOptRef value; JitOptRef res; - REPLACE_OP(this_instr, _POP_TOP_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)Py_True); + JitOptRef v; + value = stack_pointer[-1]; + REPLACE_OP(this_instr, _INSERT_1_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)Py_True); res = sym_new_const(ctx, Py_True); + v = value; + CHECK_STACK_BOUNDS(1); stack_pointer[-1] = res; + stack_pointer[0] = v; + stack_pointer += 1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); break; } @@ -1073,9 +1081,22 @@ /* _SEND is not a viable micro-op for tier 2 */ case _SEND_GEN_FRAME: { + JitOptRef v; JitOptRef gen_frame; - gen_frame = PyJitRef_NULL; - ctx->done = true; + v = stack_pointer[-1]; + assert((this_instr + 1)->opcode == _PUSH_FRAME); + PyCodeObject *co = get_code_with_logging((this_instr + 1)); + if (co == NULL) { + ctx->done = true; + break; + } + _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + if (new_frame == NULL) { + ctx->done = true; + break; + } + new_frame->stack[0] = PyJitRef_StripReferenceInfo(v); + gen_frame = PyJitRef_Wrap((JitOptSymbol *)new_frame); stack_pointer[-1] = gen_frame; break; } @@ -2259,8 +2280,19 @@ case _FOR_ITER_GEN_FRAME: { JitOptRef gen_frame; - gen_frame = PyJitRef_NULL; - ctx->done = true; + assert((this_instr + 1)->opcode == _PUSH_FRAME); + PyCodeObject *co = get_code_with_logging((this_instr + 1)); + if (co == NULL) { + ctx->done = true; + break; + } + _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + if (new_frame == NULL) { + ctx->done = true; + break; + } + new_frame->stack[0] = sym_new_const(ctx, Py_None); + gen_frame = PyJitRef_Wrap((JitOptSymbol *)new_frame); CHECK_STACK_BOUNDS(1); stack_pointer[0] = gen_frame; stack_pointer += 1; @@ -3469,6 +3501,19 @@ break; } + case _INSERT_1_LOAD_CONST_INLINE_BORROW: { + JitOptRef res; + JitOptRef l; + res = sym_new_not_null(ctx); + l = sym_new_not_null(ctx); + CHECK_STACK_BOUNDS(1); + stack_pointer[-1] = res; + stack_pointer[0] = l; + stack_pointer += 1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + break; + } + case _SHUFFLE_2_LOAD_CONST_INLINE_BORROW: { JitOptRef arg; JitOptRef res; diff --git a/Python/specialize.c b/Python/specialize.c index 62f0373a4c274d..b7fa5f8ad4c04e 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -366,14 +366,8 @@ specialize_module_load_attr_lock_held(PyDictObject *dict, _Py_CODEUNIT *instr, P SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_NON_STRING); return -1; } - Py_ssize_t index = _PyDict_LookupIndex(dict, &_Py_ID(__getattr__)); + Py_ssize_t index = _PyDict_LookupIndex(dict, name); assert(index != DKIX_ERROR); - if (index != DKIX_EMPTY) { - SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_MODULE_ATTR_NOT_FOUND); - return -1; - } - index = _PyDict_LookupIndex(dict, name); - assert (index != DKIX_ERROR); if (index != (uint16_t)index) { SPECIALIZATION_FAIL(LOAD_ATTR, index == DKIX_EMPTY ?