Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the Py_SIZE() macro. #66148

Closed
gpshead opened this issue Jul 9, 2014 · 4 comments
Closed

Document the Py_SIZE() macro. #66148

gpshead opened this issue Jul 9, 2014 · 4 comments
Labels
docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@gpshead
Copy link
Member

gpshead commented Jul 9, 2014

BPO 21949
Nosy @gpshead, @berkerpeksag

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-01-22.16:43:52.140>
created_at = <Date 2014-07-09.19:44:44.585>
labels = ['easy', 'type-feature', 'docs']
title = 'Document the Py_SIZE() macro.'
updated_at = <Date 2016-01-22.21:18:28.948>
user = 'https://github.com/gpshead'

bugs.python.org fields:

activity = <Date 2016-01-22.21:18:28.948>
actor = 'gregory.p.smith'
assignee = 'docs@python'
closed = True
closed_date = <Date 2016-01-22.16:43:52.140>
closer = 'berker.peksag'
components = ['Documentation']
creation = <Date 2014-07-09.19:44:44.585>
creator = 'gregory.p.smith'
dependencies = []
files = []
hgrepos = []
issue_num = 21949
keywords = ['easy']
message_count = 4.0
messages = ['222633', '258821', '258825', '258837']
nosy_count = 5.0
nosy_names = ['gregory.p.smith', 'docs@python', 'python-dev', 'berker.peksag', 'beng94']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue21949'
versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

@gpshead
Copy link
Member Author

gpshead commented Jul 9, 2014

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).

@gpshead gpshead added the performance Performance or resource usage label Jul 9, 2014
@gpshead gpshead added docs Documentation in the Doc dir easy labels Jul 9, 2014
@berkerpeksag berkerpeksag added type-feature A feature request or enhancement and removed performance Performance or resource usage labels Oct 19, 2014
@beng94
Copy link
Mannequin

beng94 mannequin commented Jan 22, 2016

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.

@berkerpeksag
Copy link
Member

Thanks for triaging! The relevant commit is 760c5cfacbaa.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jan 22, 2016

New changeset 63183596db79 by Gregory P. Smith in branch '2.7':
Per bpo-21949 and bpo-1629: Document the Py_SIZE, Py_TYPE, Py_REFCNT macros.
https://hg.python.org/cpython/rev/63183596db79

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir easy type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants