This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Py_Size() should be named Py_SIZE()
Type: Stage:
Components: Extension Modules Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: christian.heimes, gvanrossum, loewis, python-dev, rhettinger
Priority: normal Keywords:

Created on 2007-12-14 19:45 by rhettinger, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (11)
msg58634 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2007-12-14 19:45
It would be helpful to have the name provide a cue that a macro is being
used.
msg58635 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-12-14 19:54
Agreed.
msg58636 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-12-14 20:13
I assume that applies to Py_Refcnt and Py_Type as well?
msg58637 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-14 21:05
I think it would be easier to merge from trunk to py3k before the change
and skip the revision in the next merge. The rename can be done with a
simple find | xargs sed -i. A merge might be more painful.
msg58734 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-18 09:40
I tried a simple find | xargs sed replace and it worked well.

find -name '*.c' -or -name '*.h' -or -name '*.rst' | xargs sed -i
s/Py_Size\(/Py_SIZE\(/g
msg58793 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-19 06:47
I've renamed the three macros and added the old names for b/w compatibility.
msg58797 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-12-19 08:02
Why the compatibility?
msg58798 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-12-19 08:06
FWIW, should PyUnicode_Check, PyTuple_Check etc. also change to
PyUnicode_CHECK, PyTuple_CHECK etc because they are macros?
msg58799 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-12-19 08:08
I've fixed PEP 3123 to update the spelling.
msg58818 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-12-19 18:37
> FWIW, should PyUnicode_Check, PyTuple_Check etc. also change to
> PyUnicode_CHECK, PyTuple_CHECK etc because they are macros?

While this would technically be the right thing to do, those macros
have had a long and productive life before 2.6 so I'd rather be
compatible. IOW no.
msg258838 - (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 issue21949 and issue1629: 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:56:29adminsetgithub: 45970
2016-01-22 21:17:59python-devsetnosy: + python-dev
messages: + msg258838
2007-12-19 18:37:04gvanrossumsetmessages: + msg58818
2007-12-19 08:08:25loewissetmessages: + msg58799
2007-12-19 08:06:50loewissetmessages: + msg58798
2007-12-19 08:02:35loewissetmessages: + msg58797
2007-12-19 06:48:01christian.heimessetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg58793
2007-12-18 19:14:56gvanrossumsetresolution: accepted
2007-12-18 09:40:43christian.heimessetmessages: + msg58734
2007-12-14 21:05:45christian.heimessetnosy: + christian.heimes
messages: + msg58637
2007-12-14 20:13:27loewissetmessages: + msg58636
2007-12-14 19:54:30gvanrossumsetnosy: + gvanrossum
messages: + msg58635
2007-12-14 19:45:41rhettingercreate