Skip to content

Commit a052d10

Browse files
committed
PUSH_EXC_INFO
1 parent 121bc55 commit a052d10

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

Python/bytecodes.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,21 +2349,17 @@ dummy_func(
23492349
}
23502350

23512351
// stack effect: ( -- __0)
2352-
inst(PUSH_EXC_INFO) {
2353-
PyObject *value = TOP();
2354-
2352+
inst(PUSH_EXC_INFO, (new_exc -- prev_exc, new_exc)) {
23552353
_PyErr_StackItem *exc_info = tstate->exc_info;
23562354
if (exc_info->exc_value != NULL) {
2357-
SET_TOP(exc_info->exc_value);
2355+
prev_exc = exc_info->exc_value;
23582356
}
23592357
else {
2360-
SET_TOP(Py_NewRef(Py_None));
2358+
prev_exc = Py_NewRef(Py_None);
23612359
}
2362-
2363-
PUSH(Py_NewRef(value));
2364-
assert(PyExceptionInstance_Check(value));
2365-
exc_info->exc_value = value;
2366-
2360+
assert(PyExceptionInstance_Check(new_exc));
2361+
Py_INCREF(new_exc);
2362+
exc_info->exc_value = new_exc;
23672363
}
23682364

23692365
// error: LOAD_ATTR has irregular stack effect

Python/generated_cases.c.h

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/opcode_metadata.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ _PyOpcode_num_popped(int opcode, int oparg) {
277277
case WITH_EXCEPT_START:
278278
return 4;
279279
case PUSH_EXC_INFO:
280-
return -1;
280+
return 1;
281281
case LOAD_ATTR_METHOD_WITH_VALUES:
282282
return -1;
283283
case LOAD_ATTR_METHOD_NO_DICT:
@@ -623,7 +623,7 @@ _PyOpcode_num_pushed(int opcode, int oparg) {
623623
case WITH_EXCEPT_START:
624624
return 5;
625625
case PUSH_EXC_INFO:
626-
return -1;
626+
return 2;
627627
case LOAD_ATTR_METHOD_WITH_VALUES:
628628
return -1;
629629
case LOAD_ATTR_METHOD_NO_DICT:

0 commit comments

Comments
 (0)