GeezerVison is showing github.com — gh-119180: Add LOAD_COMMON_CONSTANT opcode (#119321) · python/cpython@98e855f
File tree
Expand file treeCollapse file tree
Open diff view settings
Misc/NEWS.d/next/Core and Builtins
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Doc/library/dis.rst +5-4Lines changed: 5 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -929,12 +929,13 @@ iterations of the loop. |
929 | 929 | Exception representation on the stack now consist of one, not three, items. |
930 | 930 |
|
931 | 931 |
|
932 | | -.. opcode:: LOAD_ASSERTION_ERROR |
| 932 | +.. opcode:: LOAD_COMMON_CONSTANT |
933 | 933 |
|
934 | | - Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` |
935 | | - statement. |
| 934 | + Pushes a common constant onto the stack. The interpreter contains a hardcoded |
| 935 | + list of constants supported by this instruction. Used by the :keyword:`assert` |
| 936 | + statement to load :exc:`AssertionError`. |
936 | 937 |
|
937 | | - .. versionadded:: 3.9 |
| 938 | + .. versionadded:: 3.14 |
938 | 939 |
|
939 | 940 |
|
940 | 941 | .. opcode:: LOAD_BUILD_CLASS |
|
Collapse file
Copy file name to clipboardExpand all lines: Include/internal/pycore_opcode_metadata.h +8-8Lines changed: 8 additions & 8 deletions Collapse file
Copy file name to clipboardExpand all lines: Include/internal/pycore_opcode_utils.h +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,6 +58,11 @@ extern "C" { |
58 | 58 | #define MAKE_FUNCTION_ANNOTATIONS 0x04 |
59 | 59 | #define MAKE_FUNCTION_CLOSURE 0x08 |
60 | 60 |
|
| 61 | +/* Values used as the oparg for LOAD_COMMON_CONSTANT */ |
| 62 | +#define CONSTANT_ASSERTIONERROR 0 |
| 63 | +#define CONSTANT_NOTIMPLEMENTEDERROR 1 |
| 64 | +#define NUM_COMMON_CONSTANTS 2 |
| 65 | + |
61 | 66 | /* Values used in the oparg for RESUME */ |
62 | 67 | #define RESUME_AT_FUNC_START 0 |
63 | 68 | #define RESUME_AFTER_YIELD 1 |
|
Collapse file
Copy file name to clipboardExpand all lines: Include/internal/pycore_uop_ids.h +1-1Lines changed: 1 addition & 1 deletion Collapse file
Copy file name to clipboardExpand all lines: Include/internal/pycore_uop_metadata.h +3-3Lines changed: 3 additions & 3 deletions Collapse file
Copy file name to clipboardExpand all lines: Include/opcode_ids.h +61-61Lines changed: 61 additions & 61 deletions