[issue21949] Document the Py_SIZE() macro.
New submission from Gregory P. Smith: 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). ---------- assignee: docs@python components: Documentation keywords: easy messages: 222633 nosy: docs@python, gregory.p.smith priority: normal severity: normal status: open title: Document the Py_SIZE() macro. type: performance versions: Python 2.7, Python 3.4, Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21949> _______________________________________
Changes by Berker Peksag <berker.peksag@gmail.com>: ---------- stage: -> needs patch type: performance -> enhancement _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21949> _______________________________________
Gedai Tamás Bence added the comment: 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. ---------- nosy: +beng94 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21949> _______________________________________
Berker Peksag added the comment: Thanks for triaging! The relevant commit is 760c5cfacbaa. ---------- nosy: +berker.peksag resolution: -> out of date stage: needs patch -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21949> _______________________________________
Roundup Robot added the comment: New changeset 63183596db79 by Gregory P. Smith in branch '2.7': Per issue21949 and issue1629: Document the Py_SIZE, Py_TYPE, Py_REFCNT macros. https://hg.python.org/cpython/rev/63183596db79 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21949> _______________________________________
Changes by Gregory P. Smith <greg@krypto.org>: ---------- resolution: out of date -> fixed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21949> _______________________________________
participants (4)
-
Berker Peksag
-
Gedai Tamás Bence
-
Gregory P. Smith
-
Roundup Robot