@@ -270,7 +270,6 @@ dummy_func(
270
270
else {
271
271
res = Py_False ;
272
272
}
273
- Py_INCREF (res );
274
273
}
275
274
276
275
inst (UNARY_INVERT , (value -- res )) {
@@ -967,7 +966,7 @@ dummy_func(
967
966
if (PyErr_GivenExceptionMatches (exc_value , PyExc_StopIteration )) {
968
967
value = Py_NewRef (((PyStopIterationObject * )exc_value )-> value );
969
968
DECREF_INPUTS ();
970
- none = Py_NewRef ( Py_None ) ;
969
+ none = Py_None ;
971
970
}
972
971
else {
973
972
_PyErr_SetRaisedException (tstate , Py_NewRef (exc_value ));
@@ -1452,7 +1451,7 @@ dummy_func(
1452
1451
DECREF_INPUTS ();
1453
1452
ERROR_IF (true, error );
1454
1453
}
1455
- Py_DECREF ( none_val );
1454
+ assert ( Py_IsNone ( none_val ) );
1456
1455
DECREF_INPUTS ();
1457
1456
}
1458
1457
@@ -1993,7 +1992,6 @@ dummy_func(
1993
1992
_Py_DECREF_SPECIALIZED (left , _PyFloat_ExactDealloc );
1994
1993
_Py_DECREF_SPECIALIZED (right , _PyFloat_ExactDealloc );
1995
1994
res = (sign_ish & oparg ) ? Py_True : Py_False ;
1996
- Py_INCREF (res );
1997
1995
}
1998
1996
1999
1997
// Similar to COMPARE_OP_FLOAT
@@ -2012,7 +2010,6 @@ dummy_func(
2012
2010
_Py_DECREF_SPECIALIZED (left , (destructor )PyObject_Free );
2013
2011
_Py_DECREF_SPECIALIZED (right , (destructor )PyObject_Free );
2014
2012
res = (sign_ish & oparg ) ? Py_True : Py_False ;
2015
- Py_INCREF (res );
2016
2013
}
2017
2014
2018
2015
// Similar to COMPARE_OP_FLOAT, but for ==, != only
@@ -2028,20 +2025,19 @@ dummy_func(
2028
2025
assert ((oparg & 0xf ) == COMPARISON_NOT_EQUALS || (oparg & 0xf ) == COMPARISON_EQUALS );
2029
2026
assert (COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS );
2030
2027
res = ((COMPARISON_NOT_EQUALS + eq ) & oparg ) ? Py_True : Py_False ;
2031
- Py_INCREF (res );
2032
2028
}
2033
2029
2034
2030
inst (IS_OP , (left , right -- b )) {
2035
2031
int res = Py_Is (left , right ) ^ oparg ;
2036
2032
DECREF_INPUTS ();
2037
- b = Py_NewRef ( res ? Py_True : Py_False ) ;
2033
+ b = res ? Py_True : Py_False ;
2038
2034
}
2039
2035
2040
2036
inst (CONTAINS_OP , (left , right -- b )) {
2041
2037
int res = PySequence_Contains (right , left );
2042
2038
DECREF_INPUTS ();
2043
2039
ERROR_IF (res < 0 , error );
2044
- b = Py_NewRef (( res ^ oparg ) ? Py_True : Py_False ) ;
2040
+ b = ( res ^ oparg ) ? Py_True : Py_False ;
2045
2041
}
2046
2042
2047
2043
inst (CHECK_EG_MATCH , (exc_value , match_type -- rest , match )) {
@@ -2074,7 +2070,7 @@ dummy_func(
2074
2070
2075
2071
int res = PyErr_GivenExceptionMatches (left , right );
2076
2072
DECREF_INPUTS ();
2077
- b = Py_NewRef ( res ? Py_True : Py_False ) ;
2073
+ b = res ? Py_True : Py_False ;
2078
2074
}
2079
2075
2080
2076
inst (IMPORT_NAME , (level , fromlist -- res )) {
@@ -2101,14 +2097,10 @@ dummy_func(
2101
2097
}
2102
2098
2103
2099
inst (POP_JUMP_IF_FALSE , (cond -- )) {
2104
- if (Py_IsTrue (cond )) {
2105
- _Py_DECREF_NO_DEALLOC (cond );
2106
- }
2107
- else if (Py_IsFalse (cond )) {
2108
- _Py_DECREF_NO_DEALLOC (cond );
2100
+ if (Py_IsFalse (cond )) {
2109
2101
JUMPBY (oparg );
2110
2102
}
2111
- else {
2103
+ else if (! Py_IsTrue ( cond )) {
2112
2104
int err = PyObject_IsTrue (cond );
2113
2105
DECREF_INPUTS ();
2114
2106
if (err == 0 ) {
@@ -2121,14 +2113,10 @@ dummy_func(
2121
2113
}
2122
2114
2123
2115
inst (POP_JUMP_IF_TRUE , (cond -- )) {
2124
- if (Py_IsFalse (cond )) {
2125
- _Py_DECREF_NO_DEALLOC (cond );
2126
- }
2127
- else if (Py_IsTrue (cond )) {
2128
- _Py_DECREF_NO_DEALLOC (cond );
2116
+ if (Py_IsTrue (cond )) {
2129
2117
JUMPBY (oparg );
2130
2118
}
2131
- else {
2119
+ else if (! Py_IsFalse ( cond )) {
2132
2120
int err = PyObject_IsTrue (cond );
2133
2121
DECREF_INPUTS ();
2134
2122
if (err > 0 ) {
@@ -2145,14 +2133,10 @@ dummy_func(
2145
2133
DECREF_INPUTS ();
2146
2134
JUMPBY (oparg );
2147
2135
}
2148
- else {
2149
- _Py_DECREF_NO_DEALLOC (value );
2150
- }
2151
2136
}
2152
2137
2153
2138
inst (POP_JUMP_IF_NONE , (value -- )) {
2154
2139
if (Py_IsNone (value )) {
2155
- _Py_DECREF_NO_DEALLOC (value );
2156
2140
JUMPBY (oparg );
2157
2141
}
2158
2142
else {
@@ -2188,19 +2172,19 @@ dummy_func(
2188
2172
}
2189
2173
else {
2190
2174
ERROR_IF (_PyErr_Occurred (tstate ), error ); // Error!
2191
- attrs = Py_NewRef ( Py_None ) ; // Failure!
2175
+ attrs = Py_None ; // Failure!
2192
2176
}
2193
2177
}
2194
2178
2195
2179
inst (MATCH_MAPPING , (subject -- subject , res )) {
2196
2180
int match = Py_TYPE (subject )-> tp_flags & Py_TPFLAGS_MAPPING ;
2197
- res = Py_NewRef ( match ? Py_True : Py_False ) ;
2181
+ res = match ? Py_True : Py_False ;
2198
2182
PREDICT (POP_JUMP_IF_FALSE );
2199
2183
}
2200
2184
2201
2185
inst (MATCH_SEQUENCE , (subject -- subject , res )) {
2202
2186
int match = Py_TYPE (subject )-> tp_flags & Py_TPFLAGS_SEQUENCE ;
2203
- res = Py_NewRef ( match ? Py_True : Py_False ) ;
2187
+ res = match ? Py_True : Py_False ;
2204
2188
PREDICT (POP_JUMP_IF_FALSE );
2205
2189
}
2206
2190
@@ -2392,7 +2376,7 @@ dummy_func(
2392
2376
STAT_INC (FOR_ITER , hit );
2393
2377
_PyInterpreterFrame * gen_frame = (_PyInterpreterFrame * )gen -> gi_iframe ;
2394
2378
frame -> return_offset = oparg ;
2395
- _PyFrame_StackPush (gen_frame , Py_NewRef ( Py_None ) );
2379
+ _PyFrame_StackPush (gen_frame , Py_None );
2396
2380
gen -> gi_frame_state = FRAME_EXECUTING ;
2397
2381
gen -> gi_exc_state .previous_item = tstate -> exc_info ;
2398
2382
tstate -> exc_info = & gen -> gi_exc_state ;
@@ -2499,7 +2483,7 @@ dummy_func(
2499
2483
prev_exc = exc_info -> exc_value ;
2500
2484
}
2501
2485
else {
2502
- prev_exc = Py_NewRef ( Py_None ) ;
2486
+ prev_exc = Py_None ;
2503
2487
}
2504
2488
assert (PyExceptionInstance_Check (new_exc ));
2505
2489
exc_info -> exc_value = Py_NewRef (new_exc );
@@ -3393,7 +3377,6 @@ dummy_func(
3393
3377
_Py_CODEUNIT * here = next_instr - 1 ;
3394
3378
int offset ;
3395
3379
if (Py_IsNone (value )) {
3396
- _Py_DECREF_NO_DEALLOC (value );
3397
3380
offset = oparg ;
3398
3381
}
3399
3382
else {
@@ -3408,7 +3391,6 @@ dummy_func(
3408
3391
_Py_CODEUNIT * here = next_instr - 1 ;
3409
3392
int offset ;
3410
3393
if (Py_IsNone (value )) {
3411
- _Py_DECREF_NO_DEALLOC (value );
3412
3394
offset = 0 ;
3413
3395
}
3414
3396
else {
0 commit comments