| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 62a0a2a commit 396b583
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -474,13 +474,15 @@ the original TOS1. | |||
| 474 | 474 | .. opcode:: END_ASYNC_FOR | |
| 475 | 475 | ||
| 476 | 476 | Terminates an :keyword:`async for` loop. Handles an exception raised | |
| 477 | - when awaiting a next item. If TOS is :exc:`StopAsyncIteration` pop 7 | ||
| 477 | + when awaiting a next item. If TOS is :exc:`StopAsyncIteration` pop 3 | ||
| 478 | 478 | values from the stack and restore the exception state using the second | |
| 479 | - three of them. Otherwise re-raise the exception using the three values | ||
| 479 | + of them. Otherwise re-raise the exception using the value | ||
| 480 | 480 | from the stack. An exception handler block is removed from the block stack. | |
| 481 | 481 | ||
| 482 | 482 | .. versionadded:: 3.8 | |
| 483 | 483 | ||
| 484 | + .. versionchanged:: 3.11 | ||
| 485 | + Exception representation on the stack now consist of one, not three, items. | ||
| 484 | 486 | ||
| 485 | 487 | .. opcode:: BEFORE_ASYNC_WITH | |
| 486 | 488 | ||
@@ -561,8 +563,10 @@ iterations of the loop. | |||
| 561 | 563 | ||
| 562 | 564 | .. opcode:: POP_EXCEPT | |
| 563 | 565 | ||
| 564 | - Pops three values from the stack, which are used to restore the exception state. | ||
| 566 | + Pops a value from the stack, which is used to restore the exception state. | ||
| 565 | 567 | ||
| 568 | + .. versionchanged:: 3.11 | ||
| 569 | + Exception representation on the stack now consist of one, not three, items. | ||
| 566 | 570 | ||
| 567 | 571 | .. opcode:: RERAISE | |
| 568 | 572 | ||
@@ -572,27 +576,32 @@ iterations of the loop. | |||
| 572 | 576 | ||
| 573 | 577 | .. versionadded:: 3.9 | |
| 574 | 578 | ||
| 579 | + .. versionchanged:: 3.11 | ||
| 580 | + Exception representation on the stack now consist of one, not three, items. | ||
| 575 | 581 | ||
| 576 | 582 | .. opcode:: PUSH_EXC_INFO | |
| 577 | 583 | ||
| 578 | - Pops the three values from the stack. Pushes the current exception to the top of the stack. | ||
| 579 | - Pushes the three values originally popped back to the stack. | ||
| 584 | + Pops a value from the stack. Pushes the current exception to the top of the stack. | ||
| 585 | + Pushes the value originally popped back to the stack. | ||
| 580 | 586 | Used in exception handlers. | |
| 581 | 587 | ||
| 582 | 588 | .. versionadded:: 3.11 | |
| 583 | 589 | ||
| 584 | 590 | ||
| 585 | 591 | .. opcode:: WITH_EXCEPT_START | |
| 586 | 592 | ||
| 587 | - Calls the function in position 8 on the stack with the top three | ||
| 588 | - items on the stack as arguments. | ||
| 593 | + Calls the function in position 4 on the stack with arguments (type, val, tb) | ||
| 594 | + representing the exception at the top of the stack. | ||
| 589 | 595 | Used to implement the call ``context_manager.__exit__(*exc_info())`` when an exception | |
| 590 | 596 | has occurred in a :keyword:`with` statement. | |
| 591 | 597 | ||
| 592 | 598 | .. versionadded:: 3.9 | |
| 593 | 599 | .. versionchanged:: 3.11 | |
| 594 | 600 | The ``__exit__`` function is in position 8 of the stack rather than 7. | |
| 595 | 601 | ||
| 602 | + .. versionchanged:: 3.11 | ||
| 603 | + The ``__exit__`` function is in position 4 of the stack rather than 7. | ||
| 604 | + Exception representation on the stack now consist of one, not three, items. | ||
| 596 | 605 | ||
| 597 | 606 | .. opcode:: POP_EXCEPT_AND_RERAISE | |
| 598 | 607 | ||
@@ -890,10 +899,9 @@ All of the following opcodes use their arguments. | |||
| 890 | 899 | Performs exception matching for ``except*``. Applies ``split(TOS)`` on | |
| 891 | 900 | the exception group representing TOS1. Jumps if no match is found. | |
| 892 | 901 | ||
| 893 | - Pops one item from the stack. If a match was found, pops the 3 items representing | ||
| 894 | - the exception and pushes the 3 items representing the non-matching part of | ||
| 895 | - the exception group, followed by the 3 items representing the matching part. | ||
| 896 | - In other words, in case of a match it pops 4 items and pushes 6. | ||
| 902 | + Pops one item from the stack (the match type). If a match was found, | ||
| 903 | + next item (the exception) and pushes the non-matching part of the | ||
| 904 | + exception group followed by the matching part. | ||
| 897 | 905 | ||
| 898 | 906 | .. versionadded:: 3.11 | |
| 899 | 907 | ||
@@ -903,8 +911,8 @@ All of the following opcodes use their arguments. | |||
| 903 | 911 | Combines the raised and reraised exceptions list from TOS, into an exception | |
| 904 | 912 | group to propagate from a try-except* block. Uses the original exception | |
| 905 | 913 | group from TOS1 to reconstruct the structure of reraised exceptions. Pops | |
| 906 | - two items from the stack and pushes a triplet representing the exception to | ||
| 907 | - reraise or three ``None`` if there isn't one. | ||
| 914 | + two items from the stack and pushes 0 (for lasti, which is unused) followed | ||
| 915 | + by the exception to reraise or ``None`` if there isn't one. | ||
| 908 | 916 | ||
| 909 | 917 | .. versionadded:: 3.11 | |
| 910 | 918 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -195,6 +195,11 @@ Other CPython Implementation Changes | |||
| 195 | 195 | reflected in the re-raised exception. | |
| 196 | 196 | (Contributed by Irit Katriel in :issue:`45711`.) | |
| 197 | 197 | ||
| 198 | + * The interpreter state's representation of handled exceptions (a.k.a exc_info, or | ||
| 199 | + _PyErr_StackItem) now has only the ``exc_value`` field, ``exc_type`` and ``exc_traceback`` | ||
| 200 | + have been removed as their values can be derived from ``exc_value``. | ||
| 201 | + (Contributed by Irit Katriel in :issue:`45711`.) | ||
| 202 | + | ||
| 198 | 203 | New Modules | |
| 199 | 204 | =========== | |
| 200 | 205 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,7 +56,7 @@ typedef struct _err_stackitem { | |||
| 56 | 56 | * This ensures that the exception state is not impacted by "yields" | |
| 57 | 57 | * from an except handler. | |
| 58 | 58 | */ | |
| 59 | - PyObject *exc_type, *exc_value, *exc_traceback; | ||
| 59 | + PyObject *exc_value; | ||
| 60 | 60 | ||
| 61 | 61 | struct _err_stackitem *previous_item; | |
| 62 | 62 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,16 +24,7 @@ static inline PyObject* _PyErr_Occurred(PyThreadState *tstate) | |||
| 24 | 24 | ||
| 25 | 25 | static inline void _PyErr_ClearExcState(_PyErr_StackItem *exc_state) | |
| 26 | 26 | { | |
| 27 | - PyObject *t, *v, *tb; | ||
| 28 | - t = exc_state->exc_type; | ||
| 29 | - v = exc_state->exc_value; | ||
| 30 | - tb = exc_state->exc_traceback; | ||
| 31 | - exc_state->exc_type = NULL; | ||
| 32 | - exc_state->exc_value = NULL; | ||
| 33 | - exc_state->exc_traceback = NULL; | ||
| 34 | - Py_XDECREF(t); | ||
| 35 | - Py_XDECREF(v); | ||
| 36 | - Py_XDECREF(tb); | ||
| 27 | + Py_CLEAR(exc_state->exc_value); | ||
| 37 | 28 | } | |
| 38 | 29 | ||
| 39 | 30 | PyAPI_FUNC(PyObject*) _PyErr_StackItemToExcInfoTuple( | |
@@ -114,6 +105,7 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalRefcountErrorFunc( | |||
| 114 | 105 | ||
| 115 | 106 | #define _Py_FatalRefcountError(message) _Py_FatalRefcountErrorFunc(__func__, message) | |
| 116 | 107 | ||
| 108 | + | ||
| 117 | 109 | #ifdef __cplusplus | |
| 118 | 110 | } | |
| 119 | 111 | #endif | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -371,9 +371,10 @@ def _write_atomic(path, data, mode=0o666): | |||
| 371 | 371 | # Python 3.11a3 3464 (bpo-45636: Merge numeric BINARY_*/INPLACE_* into | |
| 372 | 372 | # BINARY_OP) | |
| 373 | 373 | # Python 3.11a3 3465 (Add COPY_FREE_VARS opcode) | |
| 374 | - # Python 3.11a3 3466 (bpo-45292: PEP-654 except*) | ||
| 374 | + # Python 3.11a4 3466 (bpo-45292: PEP-654 except*) | ||
| 375 | 375 | # Python 3.11a4 3467 (Change CALL_xxx opcodes) | |
| 376 | 376 | # Python 3.11a4 3468 (Add SEND opcode) | |
| 377 | + # Python 3.11a4 3469 (bpo-45711: remove type, traceback from exc_info) | ||
| 377 | 378 | ||
| 378 | 379 | # | |
| 379 | 380 | # MAGIC must change whenever the bytecode emitted by the compiler may no | |
@@ -383,7 +384,7 @@ def _write_atomic(path, data, mode=0o666): | |||
| 383 | 384 | # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array | |
| 384 | 385 | # in PC/launcher.c must also be updated. | |
| 385 | 386 | ||
| 386 | - MAGIC_NUMBER = (3468).to_bytes(2, 'little') + b'\r\n' | ||
| 387 | + MAGIC_NUMBER = (3469).to_bytes(2, 'little') + b'\r\n' | ||
| 387 | 388 | _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c | |
| 388 | 389 | ||
| 389 | 390 | _PYCACHE = '__pycache__' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments