mirror of
https://github.com/python/cpython.git
synced 2025-10-15 19:29:46 +00:00
bpo-39573: Use Py_SET_SIZE() function (GH-18402)
Replace direct acccess to PyVarObject.ob_size with usage of the Py_SET_SIZE() function.
This commit is contained in:
parent
de6f38db48
commit
60ac6ed557
16 changed files with 95 additions and 86 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue