@@ -5274,15 +5274,15 @@ dictiter_iternextitem_lock_held(PyDictObject *d, PyObject *self,
5274
5274
5275
5275
// Grabs the key and/or value from the provided locations and if successful
5276
5276
// returns them with an increased reference count. If either one is unsucessful
5277
- // nothing is incref'd and returns 0 .
5277
+ // nothing is incref'd and returns -1 .
5278
5278
static int
5279
5279
acquire_key_value (PyObject * * key_loc , PyObject * value , PyObject * * value_loc ,
5280
5280
PyObject * * out_key , PyObject * * out_value )
5281
5281
{
5282
5282
if (out_key ) {
5283
5283
* out_key = _Py_TryXGetRef (key_loc );
5284
5284
if (* out_key == NULL ) {
5285
- return 0 ;
5285
+ return -1 ;
5286
5286
}
5287
5287
}
5288
5288
@@ -5291,12 +5291,12 @@ acquire_key_value(PyObject **key_loc, PyObject *value, PyObject **value_loc,
5291
5291
if (out_key ) {
5292
5292
Py_DECREF (* out_key );
5293
5293
}
5294
- return 0 ;
5294
+ return -1 ;
5295
5295
}
5296
5296
* out_value = value ;
5297
5297
}
5298
5298
5299
- return 1 ;
5299
+ return 0 ;
5300
5300
}
5301
5301
5302
5302
static Py_ssize_t
@@ -5344,8 +5344,8 @@ dictiter_iternext_threadsafe(PyDictObject *d, PyObject *self,
5344
5344
// here.
5345
5345
int index = get_index_from_order (d , i );
5346
5346
PyObject * value = _Py_atomic_load_ptr (& values -> values [index ]);
5347
- if (! acquire_key_value (& DK_UNICODE_ENTRIES (k )[index ].me_key , value ,
5348
- & values -> values [index ], out_key , out_value )) {
5347
+ if (acquire_key_value (& DK_UNICODE_ENTRIES (k )[index ].me_key , value ,
5348
+ & values -> values [index ], out_key , out_value ) < 0 ) {
5349
5349
goto try_locked ;
5350
5350
}
5351
5351
}
@@ -5362,8 +5362,8 @@ dictiter_iternext_threadsafe(PyDictObject *d, PyObject *self,
5362
5362
if (i >= n )
5363
5363
goto fail ;
5364
5364
5365
- if (! acquire_key_value (& entry_ptr -> me_key , value ,
5366
- & entry_ptr -> me_value , out_key , out_value )) {
5365
+ if (acquire_key_value (& entry_ptr -> me_key , value ,
5366
+ & entry_ptr -> me_value , out_key , out_value ) < 0 ) {
5367
5367
goto try_locked ;
5368
5368
}
5369
5369
}
@@ -5379,8 +5379,8 @@ dictiter_iternext_threadsafe(PyDictObject *d, PyObject *self,
5379
5379
if (i >= n )
5380
5380
goto fail ;
5381
5381
5382
- if (! acquire_key_value (& entry_ptr -> me_key , value ,
5383
- & entry_ptr -> me_value , out_key , out_value )) {
5382
+ if (acquire_key_value (& entry_ptr -> me_key , value ,
5383
+ & entry_ptr -> me_value , out_key , out_value ) < 0 ) {
5384
5384
goto try_locked ;
5385
5385
}
5386
5386
}
0 commit comments