diff options
author | scoder <stefan_ml@behnel.de> | 2023-11-03 11:02:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-03 11:02:39 (GMT) |
commit | 24ddaee5ca112063b460e72d31b3da551a02bf0a (patch) | |
tree | 24407ff8b7373cba709e1656900d3f53b5be2d24 /Include | |
parent | d49aba5a7a3c695213810a9f82715809c6332df2 (diff) | |
download | cpython-24ddaee5ca112063b460e72d31b3da551a02bf0a.zip cpython-24ddaee5ca112063b460e72d31b3da551a02bf0a.tar.gz cpython-24ddaee5ca112063b460e72d31b3da551a02bf0a.tar.bz2 |
gh-106168: Revert the "size before item" setting (#111683)
gh-106168: Update the size only after setting the item, to avoid temporary inconsistencies.
Also remove the "what's new" sentence regarding the size setting since tuples cannot grow after allocation.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_list.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/internal/pycore_list.h b/Include/internal/pycore_list.h index 056be2c..55d67b3 100644 --- a/Include/internal/pycore_list.h +++ b/Include/internal/pycore_list.h @@ -51,8 +51,8 @@ _PyList_AppendTakeRef(PyListObject *self, PyObject *newitem) Py_ssize_t allocated = self->allocated; assert((size_t)len + 1 < PY_SSIZE_T_MAX); if (allocated > len) { - Py_SET_SIZE(self, len + 1); PyList_SET_ITEM(self, len, newitem); + Py_SET_SIZE(self, len + 1); return 0; } return _PyList_AppendTakeRefListResize(self, newitem); |