@@ -83,6 +83,8 @@ static PyObject *value, *value1, *value2, *left, *right, *res, *sum, *prod, *sub
83
83
static PyObject * container , * start , * stop , * v , * lhs , * rhs ;
84
84
static PyObject * list , * tuple , * dict ;
85
85
static PyObject * exit_func , * lasti , * val ;
86
+ #define _BINARY_OP_INPLACE_ADD_UNICODE_PART_1 1
87
+ #define _BINARY_OP_INPLACE_ADD_UNICODE_PART_2 2
86
88
87
89
static PyObject *
88
90
dummy_func (
@@ -197,7 +199,7 @@ dummy_func(
197
199
BINARY_OP_ADD_FLOAT ,
198
200
BINARY_OP_ADD_INT ,
199
201
BINARY_OP_ADD_UNICODE ,
200
- // BINARY_OP_INPLACE_ADD_UNICODE, // This is an odd duck.
202
+ _BINARY_OP_INPLACE_ADD_UNICODE_PART_1 ,
201
203
BINARY_OP_MULTIPLY_FLOAT ,
202
204
BINARY_OP_MULTIPLY_INT ,
203
205
BINARY_OP_SUBTRACT_FLOAT ,
@@ -263,13 +265,10 @@ dummy_func(
263
265
ERROR_IF (res == NULL , error );
264
266
}
265
267
266
- // This is a subtle one. It's a super-instruction for
267
- // BINARY_OP_ADD_UNICODE followed by STORE_FAST
268
- // where the store goes into the left argument.
269
- // So the inputs are the same as for all BINARY_OP
270
- // specializations, but there is no output.
271
- // At the end we just skip over the STORE_FAST.
272
- inst (BINARY_OP_INPLACE_ADD_UNICODE , (left , right -- )) {
268
+ // Part 1's output effect is a lie -- it has no result.
269
+ // Part 2's input effect is equally a lie, and the two lies
270
+ // cancel each other out.
271
+ op (_BINARY_OP_INPLACE_ADD_UNICODE_PART_1 , (left , right , unused /1 -- unused )) {
273
272
assert (cframe .use_tracing == 0 );
274
273
DEOPT_IF (!PyUnicode_CheckExact (left ), BINARY_OP );
275
274
DEOPT_IF (Py_TYPE (right ) != Py_TYPE (left ), BINARY_OP );
@@ -295,9 +294,12 @@ dummy_func(
295
294
PyUnicode_Append (target_local , right );
296
295
_Py_DECREF_SPECIALIZED (right , _PyUnicode_ExactDealloc );
297
296
ERROR_IF (* target_local == NULL , error );
298
- // The STORE_FAST is already done.
299
- JUMPBY (INLINE_CACHE_ENTRIES_BINARY_OP + 1 );
300
297
}
298
+ op (_BINARY_OP_INPLACE_ADD_UNICODE_PART_2 , (unused -- )) {
299
+ // The STORE_FAST is already done; oparg is dead.
300
+ }
301
+ super (BINARY_OP_INPLACE_ADD_UNICODE ) =
302
+ _BINARY_OP_INPLACE_ADD_UNICODE_PART_1 + _BINARY_OP_INPLACE_ADD_UNICODE_PART_2 ;
301
303
302
304
inst (BINARY_OP_ADD_FLOAT , (left , right , unused /1 -- sum )) {
303
305
assert (cframe .use_tracing == 0 );
0 commit comments