diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-07 22:18:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 22:18:08 (GMT) |
commit | 60ac6ed5579f6666130fc264d3b748ee9575e3aa (patch) | |
tree | c21d06611bea34d88dd5922850223837fa6ae733 /Python | |
parent | de6f38db4859f7b8fe4da4556f06c52675fff24a (diff) | |
download | cpython-60ac6ed5579f6666130fc264d3b748ee9575e3aa.zip cpython-60ac6ed5579f6666130fc264d3b748ee9575e3aa.tar.gz cpython-60ac6ed5579f6666130fc264d3b748ee9575e3aa.tar.bz2 |
bpo-39573: Use Py_SET_SIZE() function (GH-18402)
Replace direct acccess to PyVarObject.ob_size with usage of
the Py_SET_SIZE() function.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 2 | ||||
-rw-r--r-- | Python/hamt.c | 4 | ||||
-rw-r--r-- | Python/marshal.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index c36a38e..deba99e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4436,7 +4436,7 @@ unpack_iterable(PyThreadState *tstate, PyObject *v, *--sp = PyList_GET_ITEM(l, ll - j); } /* Resize the list. */ - Py_SIZE(l) = ll - argcntafter; + Py_SET_SIZE(l, ll - argcntafter); Py_DECREF(it); return 1; diff --git a/Python/hamt.c b/Python/hamt.c index f5586ee..a0fee4c 100644 --- a/Python/hamt.c +++ b/Python/hamt.c @@ -551,7 +551,7 @@ hamt_node_bitmap_new(Py_ssize_t size) return NULL; } - Py_SIZE(node) = size; + Py_SET_SIZE(node, size); for (i = 0; i < size; i++) { node->b_array[i] = NULL; @@ -1288,7 +1288,7 @@ hamt_node_collision_new(int32_t hash, Py_ssize_t size) node->c_array[i] = NULL; } - Py_SIZE(node) = size; + Py_SET_SIZE(node, size); node->c_hash = hash; _PyObject_GC_TRACK(node); diff --git a/Python/marshal.c b/Python/marshal.c index 8d441a4..04a8dc5 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -813,7 +813,7 @@ r_PyLong(RFILE *p) if (ob == NULL) return NULL; - Py_SIZE(ob) = n > 0 ? size : -size; + Py_SET_SIZE(ob, n > 0 ? size : -size); for (i = 0; i < size-1; i++) { d = 0; |