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: dictobject and dictentry not used consistently in dictobject.c
Type: Stage:
Components: Interpreter Core Versions: Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: anthon, brett.cannon, gvanrossum
Priority: low Keywords: patch

Created on 2007-10-05 07:30 by anthon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
dictobject.c.patch anthon, 2007-10-05 07:30
dict_cleanup.diff brett.cannon, 2007-10-09 23:27
Messages (6)
msg56234 - (view) Author: Anthon van der Neut (anthon) * Date: 2007-10-05 07:30
In dictobject.c the structures from dictobject.h are typedeffed to:
typedef PyDictEntry dictentry;
typedef PyDictObject dictobject;

However there are still a few locations in that file where the
PyDictEntry and PyDictObject types are used directly. IMHO these should
be replaced by  dictentry resp. dictobject

Attached is a patch for that.
msg56240 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-10-05 15:11
I think it would be better to get rid of the typedefs and use the public
Py* names everywhere?
msg56250 - (view) Author: Anthon van der Neut (anthon) * Date: 2007-10-06 06:29
Guido's suggestion to change all entries to PyDictEntry resp.
PyDictObject would work as well and declutter the code in a better way.

The only advantage of the typedefs that I see (and briefly used) it that
it is easy to have structures local to dictobject.c that hold some more
information, without having to touch dictobject.h (and trigger a more
general recompile. For the few that need that, they can globaly replace
PyDict{Entry,Object} when they do.
msg56261 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2007-10-07 23:39
While I understand the argument for faster recompiles, dictobject.(c|h)
do not change that often, and thus faster recompiles are not critical. 
I am with Guido and would rather see the module moved over to public names.

Setting the priority to low as this is not critical in any way, although
I am all for making code more readable and thus will review any patch
that Anthon comes up with that uses the public names.
msg56297 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2007-10-09 23:27
I went ahead and had Vim do a global search-and-replace on the names and
ditched the typedefs; the patch is uploaded.  I have not yet run the
test suite, though, which is why I have not committed it.  But if it
passes I will just check it in.
msg56300 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2007-10-10 00:08
Applied my patch in r58399.  Thanks for noticing the inconsistency, anthon!
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45579
2007-10-10 00:08:51brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg56300
2007-10-09 23:27:03brett.cannonsetfiles: + dict_cleanup.diff
assignee: brett.cannon
messages: + msg56297
2007-10-07 23:39:59brett.cannonsetnosy: + brett.cannon
messages: + msg56261
2007-10-07 23:24:50brett.cannonsetpriority: low
2007-10-07 21:07:45loewissetkeywords: + patch
2007-10-06 06:29:25anthonsetmessages: + msg56250
2007-10-05 15:11:03gvanrossumsetnosy: + gvanrossum
messages: + msg56240
2007-10-05 07:30:54anthoncreate