Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1d7718

Browse files
committed
acquire_key_value returns -1 and 0
1 parenta079a6d commita1d7718

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎Objects/dictobject.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5274,15 +5274,15 @@ dictiter_iternextitem_lock_held(PyDictObject *d, PyObject *self,
52745274

52755275
// Grabs the key and/or value from the provided locations and if successful
52765276
// returns them with an increased reference count. If either one is unsucessful
5277-
// nothing is incref'd and returns0.
5277+
// nothing is incref'd and returns-1.
52785278
staticint
52795279
acquire_key_value(PyObject**key_loc,PyObject*value,PyObject**value_loc,
52805280
PyObject**out_key,PyObject**out_value)
52815281
{
52825282
if (out_key) {
52835283
*out_key=_Py_TryXGetRef(key_loc);
52845284
if (*out_key==NULL) {
5285-
return0;
5285+
return-1;
52865286
}
52875287
}
52885288

@@ -5291,12 +5291,12 @@ acquire_key_value(PyObject **key_loc, PyObject *value, PyObject **value_loc,
52915291
if (out_key) {
52925292
Py_DECREF(*out_key);
52935293
}
5294-
return0;
5294+
return-1;
52955295
}
52965296
*out_value=value;
52975297
}
52985298

5299-
return1;
5299+
return0;
53005300
}
53015301

53025302
staticPy_ssize_t
@@ -5344,8 +5344,8 @@ dictiter_iternext_threadsafe(PyDictObject *d, PyObject *self,
53445344
// here.
53455345
intindex=get_index_from_order(d,i);
53465346
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) {
53495349
gototry_locked;
53505350
}
53515351
}
@@ -5362,8 +5362,8 @@ dictiter_iternext_threadsafe(PyDictObject *d, PyObject *self,
53625362
if (i >=n)
53635363
gotofail;
53645364

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) {
53675367
gototry_locked;
53685368
}
53695369
}
@@ -5379,8 +5379,8 @@ dictiter_iternext_threadsafe(PyDictObject *d, PyObject *self,
53795379
if (i >=n)
53805380
gotofail;
53815381

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) {
53845384
gototry_locked;
53855385
}
53865386
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp