@@ -287,7 +287,8 @@ dummy_func(
287
287
/* Need to create a fake StopIteration error here,
288
288
* to conform to PEP 380 */
289
289
if (PyStackRef_GenCheck (receiver )) {
290
- if (monitor_stop_iteration (tstate , frame , this_instr , PyStackRef_AsPyObjectBorrow (value ))) {
290
+ int err = monitor_stop_iteration (tstate , frame , this_instr , PyStackRef_AsPyObjectBorrow (value ));
291
+ if (err ) {
291
292
ERROR_NO_POP ();
292
293
}
293
294
}
@@ -302,7 +303,8 @@ dummy_func(
302
303
tier1 inst (INSTRUMENTED_END_SEND , (receiver , value -- value )) {
303
304
PyObject * receiver_o = PyStackRef_AsPyObjectBorrow (receiver );
304
305
if (PyGen_Check (receiver_o ) || PyCoro_CheckExact (receiver_o )) {
305
- if (monitor_stop_iteration (tstate , frame , this_instr , PyStackRef_AsPyObjectBorrow (value ))) {
306
+ int err = monitor_stop_iteration (tstate , frame , this_instr , PyStackRef_AsPyObjectBorrow (value ));
307
+ if (err ) {
306
308
ERROR_NO_POP ();
307
309
}
308
310
}
@@ -1069,11 +1071,12 @@ dummy_func(
1069
1071
PyStackRef_AsPyObjectBorrow (v ));
1070
1072
}
1071
1073
if (retval_o == NULL ) {
1072
- if ( _PyErr_ExceptionMatches (tstate , PyExc_StopIteration )
1073
- ) {
1074
+ int matches = _PyErr_ExceptionMatches (tstate , PyExc_StopIteration );
1075
+ if ( matches ) {
1074
1076
_PyEval_MonitorRaise (tstate , frame , this_instr );
1075
1077
}
1076
- if (_PyGen_FetchStopIterationValue (& retval_o ) == 0 ) {
1078
+ int err = _PyGen_FetchStopIterationValue (& retval_o );
1079
+ if (err == 0 ) {
1077
1080
assert (retval_o != NULL );
1078
1081
JUMPBY (oparg );
1079
1082
}
@@ -1210,7 +1213,8 @@ dummy_func(
1210
1213
assert (throwflag );
1211
1214
assert (exc_value && PyExceptionInstance_Check (exc_value ));
1212
1215
1213
- if (PyErr_GivenExceptionMatches (exc_value , PyExc_StopIteration )) {
1216
+ int matches = PyErr_GivenExceptionMatches (exc_value , PyExc_StopIteration );
1217
+ if (matches ) {
1214
1218
value = PyStackRef_FromPyObjectNew (((PyStopIterationObject * )exc_value )-> value );
1215
1219
DECREF_INPUTS ();
1216
1220
none = PyStackRef_None ;
@@ -1425,7 +1429,8 @@ dummy_func(
1425
1429
inst (LOAD_FROM_DICT_OR_GLOBALS , (mod_or_class_dict -- v )) {
1426
1430
PyObject * name = GETITEM (FRAME_CO_NAMES , oparg );
1427
1431
PyObject * v_o ;
1428
- if (PyMapping_GetOptionalItem (PyStackRef_AsPyObjectBorrow (mod_or_class_dict ), name , & v_o ) < 0 ) {
1432
+ int err = PyMapping_GetOptionalItem (PyStackRef_AsPyObjectBorrow (mod_or_class_dict ), name , & v_o );
1433
+ if (err < 0 ) {
1429
1434
ERROR_NO_POP ();
1430
1435
}
1431
1436
if (v_o == NULL ) {
@@ -1596,7 +1601,8 @@ dummy_func(
1596
1601
assert (class_dict );
1597
1602
assert (oparg >= 0 && oparg < _PyFrame_GetCode (frame )-> co_nlocalsplus );
1598
1603
name = PyTuple_GET_ITEM (_PyFrame_GetCode (frame )-> co_localsplusnames , oparg );
1599
- if (PyMapping_GetOptionalItem (class_dict , name , & value_o ) < 0 ) {
1604
+ int err = PyMapping_GetOptionalItem (class_dict , name , & value_o );
1605
+ if (err < 0 ) {
1600
1606
ERROR_NO_POP ();
1601
1607
}
1602
1608
if (!value_o ) {
@@ -1676,7 +1682,8 @@ dummy_func(
1676
1682
1677
1683
PyObject * none_val = _PyList_Extend ((PyListObject * )list , iterable );
1678
1684
if (none_val == NULL ) {
1679
- if (_PyErr_ExceptionMatches (tstate , PyExc_TypeError ) &&
1685
+ int matches = _PyErr_ExceptionMatches (tstate , PyExc_TypeError );
1686
+ if (matches &&
1680
1687
(Py_TYPE (iterable )-> tp_iter == NULL && !PySequence_Check (iterable )))
1681
1688
{
1682
1689
_PyErr_Clear (tstate );
@@ -1762,8 +1769,10 @@ dummy_func(
1762
1769
PyObject * dict_o = PyStackRef_AsPyObjectBorrow (dict );
1763
1770
PyObject * update_o = PyStackRef_AsPyObjectBorrow (update );
1764
1771
1765
- if (PyDict_Update (dict_o , update_o ) < 0 ) {
1766
- if (_PyErr_ExceptionMatches (tstate , PyExc_AttributeError )) {
1772
+ int err = PyDict_Update (dict_o , update_o );
1773
+ if (err < 0 ) {
1774
+ int matches = _PyErr_ExceptionMatches (tstate , PyExc_AttributeError );
1775
+ if (matches ) {
1767
1776
_PyErr_Format (tstate , PyExc_TypeError ,
1768
1777
"'%.200s' object is not a mapping" ,
1769
1778
Py_TYPE (update_o )-> tp_name );
@@ -1779,7 +1788,8 @@ dummy_func(
1779
1788
PyObject * dict_o = PyStackRef_AsPyObjectBorrow (dict );
1780
1789
PyObject * update_o = PyStackRef_AsPyObjectBorrow (update );
1781
1790
1782
- if (_PyDict_MergeEx (dict_o , update_o , 2 ) < 0 ) {
1791
+ int err = _PyDict_MergeEx (dict_o , update_o , 2 );
1792
+ if (err < 0 ) {
1783
1793
_PyEval_FormatKwargsError (tstate , callable_o , update_o );
1784
1794
DECREF_INPUTS ();
1785
1795
ERROR_IF (true, error );
@@ -1943,7 +1953,8 @@ dummy_func(
1943
1953
if (oparg & 1 ) {
1944
1954
/* Designed to work in tandem with CALL, pushes two values. */
1945
1955
attr_o = NULL ;
1946
- if (_PyObject_GetMethod (PyStackRef_AsPyObjectBorrow (owner ), name , & attr_o )) {
1956
+ int is_meth = _PyObject_GetMethod (PyStackRef_AsPyObjectBorrow (owner ), name , & attr_o );
1957
+ if (is_meth ) {
1947
1958
/* We can bypass temporary bound method object.
1948
1959
meth is unbound method and obj is self.
1949
1960
meth | self | arg1 | ... | argN
@@ -2416,8 +2427,8 @@ dummy_func(
2416
2427
inst (CHECK_EG_MATCH , (exc_value_st , match_type_st -- rest , match )) {
2417
2428
PyObject * exc_value = PyStackRef_AsPyObjectBorrow (exc_value_st );
2418
2429
PyObject * match_type = PyStackRef_AsPyObjectBorrow (match_type_st );
2419
-
2420
- if (_PyEval_CheckExceptStarTypeValid ( tstate , match_type ) < 0 ) {
2430
+ int err = _PyEval_CheckExceptStarTypeValid ( tstate , match_type );
2431
+ if (err < 0 ) {
2421
2432
DECREF_INPUTS ();
2422
2433
ERROR_IF (true, error );
2423
2434
}
@@ -2704,7 +2715,8 @@ dummy_func(
2704
2715
if (next_o == NULL ) {
2705
2716
next = PyStackRef_NULL ;
2706
2717
if (_PyErr_Occurred (tstate )) {
2707
- if (!_PyErr_ExceptionMatches (tstate , PyExc_StopIteration )) {
2718
+ int matches = _PyErr_ExceptionMatches (tstate , PyExc_StopIteration );
2719
+ if (!matches ) {
2708
2720
ERROR_NO_POP ();
2709
2721
}
2710
2722
_PyEval_MonitorRaise (tstate , frame , this_instr );
@@ -2729,7 +2741,8 @@ dummy_func(
2729
2741
PyObject * next_o = (* Py_TYPE (iter_o )-> tp_iternext )(iter_o );
2730
2742
if (next_o == NULL ) {
2731
2743
if (_PyErr_Occurred (tstate )) {
2732
- if (!_PyErr_ExceptionMatches (tstate , PyExc_StopIteration )) {
2744
+ int matches = _PyErr_ExceptionMatches (tstate , PyExc_StopIteration );
2745
+ if (!matches ) {
2733
2746
ERROR_NO_POP ();
2734
2747
}
2735
2748
_PyEval_MonitorRaise (tstate , frame , frame -> instr_ptr );
@@ -2756,7 +2769,8 @@ dummy_func(
2756
2769
}
2757
2770
else {
2758
2771
if (_PyErr_Occurred (tstate )) {
2759
- if (!_PyErr_ExceptionMatches (tstate , PyExc_StopIteration )) {
2772
+ int matches = _PyErr_ExceptionMatches (tstate , PyExc_StopIteration );
2773
+ if (!matches ) {
2760
2774
ERROR_NO_POP ();
2761
2775
}
2762
2776
_PyEval_MonitorRaise (tstate , frame , this_instr );
0 commit comments