Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Apr 17, 2024
1 parent c8b531d commit c81dd70
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Modules/_abc.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,14 +875,17 @@ subclasscheck_check_registry(_abc_data *impl, PyObject *subclass,
if (PyWeakref_GetRef(key, &rkey) < 0) {
// Someone inject non-weakref type in the registry.
ret = -1;
Py_DECREF(key);
break;
}

if (rkey == NULL) {
Py_DECREF(key);
continue;
}
int r = PyObject_IsSubclass(subclass, rkey);
Py_DECREF(rkey);
Py_DECREF(key);
if (r < 0) {
ret = -1;
break;
Expand Down
1 change: 0 additions & 1 deletion Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,6 @@ save_set(PickleState *state, PicklerObject *self, PyObject *obj)
int err = 0;
Py_BEGIN_CRITICAL_SECTION(obj);
while (_PySet_NextEntry(obj, &ppos, &item, &hash)) {
Py_INCREF(item);
err = save(state, self, item, 0);
Py_CLEAR(item);
if (err < 0)
Expand Down
2 changes: 2 additions & 0 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2352,12 +2352,14 @@ _PyCode_ConstantKey(PyObject *op)

item_key = _PyCode_ConstantKey(item);
if (item_key == NULL) {
Py_DECREF(item);
Py_DECREF(tuple);
return NULL;
}

assert(i < len);
PyTuple_SET_ITEM(tuple, i, item_key);
Py_DECREF(item);
i++;
}
set = PyFrozenSet_New(tuple);
Expand Down
2 changes: 1 addition & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2981,7 +2981,7 @@ dict_set_fromkeys(PyInterpreterState *interp, PyDictObject *mp,

_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(iterable);
while (_PySet_NextEntry(iterable, &pos, &key, &hash)) {
if (insertdict(interp, mp, Py_NewRef(key), hash, Py_NewRef(value))) {
if (insertdict(interp, mp, key, hash, Py_NewRef(value))) {
Py_DECREF(mp);
mp = NULL;
break;
Expand Down
1 change: 0 additions & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,6 @@ list_extend_set(PyListObject *self, PySetObject *other)
PyObject **dest = self->ob_item + m;
Py_BEGIN_CRITICAL_SECTION(other);
while (_PySet_NextEntry((PyObject *)other, &setpos, &key, &hash)) {
Py_INCREF(key);
FT_ATOMIC_STORE_PTR_RELEASE(*dest, key);
dest++;
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/setobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2669,7 +2669,7 @@ _PySet_NextEntry_lock_held(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_ha
if (ret == 0) {
return 0;
}
*key = entry->key;
*key = Py_NewRef(entry->key);
*hash = entry->hash;
return 1;
}
Expand Down
1 change: 1 addition & 0 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ merge_consts_recursive(PyObject *const_cache, PyObject *o)
Py_hash_t hash;
while (_PyFrozenSet_NextEntry(o, &pos, &item, &hash)) {
PyObject *k = merge_consts_recursive(const_cache, item);
Py_DECREF(item);
if (k == NULL) {
Py_DECREF(tuple);
Py_DECREF(key);
Expand Down
1 change: 1 addition & 0 deletions Python/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ w_complex_object(PyObject *v, char flag, WFILE *p)
}
PyObject *pair = PyTuple_Pack(2, dump, value);
Py_DECREF(dump);
Py_DECREF(value);
if (pair == NULL) {
p->error = WFERR_NOMEMORY;
break;
Expand Down
1 change: 1 addition & 0 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2916,6 +2916,7 @@ _Py_DumpExtensionModules(int fd, PyInterpreterState *interp)
&& PyUnicode_Compare(key, item) == 0)
{
is_stdlib_ext = 1;
Py_DECREF(item);
break;
}
}
Expand Down

0 comments on commit c81dd70

Please sign in to comment.