summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-05-27 12:55:10 (GMT)
committerGitHub <noreply@github.com>2020-05-27 12:55:10 (GMT)
commitfe2978b3b940fe2478335e3a2ca5ad22338cdf9c (patch)
tree046e4e97f50b96d62239f8081f7ce6263ef02d78 /Modules/arraymodule.c
parent20941de0ddc39ce9f07e29b4cc770e8a9ef14d41 (diff)
downloadcpython-fe2978b3b940fe2478335e3a2ca5ad22338cdf9c.zip
cpython-fe2978b3b940fe2478335e3a2ca5ad22338cdf9c.tar.gz
cpython-fe2978b3b940fe2478335e3a2ca5ad22338cdf9c.tar.bz2
bpo-39573: Convert Py_REFCNT and Py_SIZE to functions (GH-20429)
Convert Py_REFCNT() and Py_SIZE() macros to static inline functions. They cannot be used as l-value anymore: use Py_SET_REFCNT() and Py_SET_SIZE() to set an object reference count and size. Replace &Py_SIZE(self) with &((PyVarObject*)self)->ob_size in arraymodule.c. This change is backward incompatible on purpose, to prepare the C API for an opaque PyObject structure.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index fb1b82c..4c3ddc3 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -2525,14 +2525,14 @@ array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags)
Py_INCREF(self);
if (view->buf == NULL)
view->buf = (void *)emptybuf;
- view->len = (Py_SIZE(self)) * self->ob_descr->itemsize;
+ view->len = Py_SIZE(self) * self->ob_descr->itemsize;
view->readonly = 0;
view->ndim = 1;
view->itemsize = self->ob_descr->itemsize;
view->suboffsets = NULL;
view->shape = NULL;
if ((flags & PyBUF_ND)==PyBUF_ND) {
- view->shape = &((Py_SIZE(self)));
+ view->shape = &((PyVarObject*)self)->ob_size;
}
view->strides = NULL;
if ((flags & PyBUF_STRIDES)==PyBUF_STRIDES)