Issue 21949: Document the Py_SIZE() macro. (original) (raw)

Issue21949

Created on 2014-07-09 19:44 by gregory.p.smith, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg222633 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2014-07-09 19:44
The Py_SIZE() macro is not documented. It should be. It is very useful along with PyList_New(positive_number) after using PyList_SET_ITEM() to fill in up to the first positive_number elements of a list object in the most optimal manner by avoiding numerous redundant array resizes and error checks along the away. The Py_SIZE() macro was introduced (in 2.6 I believe) and is specifically intended for use as an lvalue (see http://bugs.python.org/issue1724 to confirm that). It currently has uses in several places in CPython's core and modules as well as within some third party extension modules and tools such as Cython).
msg258821 - (view) Author: Tamás Bence Gedai (beng94) * Date: 2016-01-22 16:27
Py_SIZE: https://docs.python.org/3.5/c-api/structures.html#c.Py_SIZE PyList_New: https://docs.python.org/3.5/c-api/list.html#c.PyList_New I think they're documented now, so I guess the issue can be closed.
msg258825 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-01-22 16:43
Thanks for triaging! The relevant commit is 760c5cfacbaa.
msg258837 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-22 21:17
New changeset 63183596db79 by Gregory P. Smith in branch '2.7': Per and : Document the Py_SIZE, Py_TYPE, Py_REFCNT macros. https://hg.python.org/cpython/rev/63183596db79
History
Date User Action Args
2022-04-11 14:58:05 admin set github: 66148
2016-01-22 21🔞28 gregory.p.smith set resolution: out of date -> fixed
2016-01-22 21:17:59 python-dev set nosy: + python-devmessages: +
2016-01-22 16:43:52 berker.peksag set status: open -> closednosy: + berker.peksagmessages: + resolution: out of datestage: needs patch -> resolved
2016-01-22 16:27:42 beng94 set nosy: + beng94messages: +
2014-10-19 18:33:08 berker.peksag set type: performance -> enhancementstage: needs patch
2014-07-09 19:44:44 gregory.p.smith create