[issue1238] dictobject and dictentry not used consistently in dictobject.c
Brett Cannon added the comment: 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. -- assignee: - brett.cannon __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ dict_cleanup.diff Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Brett Cannon added the comment: Applied my patch in r58399. Thanks for noticing the inconsistency, anthon! -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Changes by Martin v. Löwis: -- keywords: +patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Changes by Brett Cannon: -- priority: - low __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Brett Cannon added the comment: 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. -- nosy: +brett.cannon __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Anthon van der Neut added the comment: 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. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
New submission from Anthon van der Neut: 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. -- components: Interpreter Core files: dictobject.c.patch messages: 56234 nosy: anthon severity: minor status: open title: dictobject and dictentry not used consistently in dictobject.c versions: Python 2.5, Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __--- ../dictobject.c 2007-10-02 16:06:08.0 +0200 +++ ./dictobject.c 2007-10-05 09:19:33.0 +0200 @@ -168,7 +168,7 @@ There are two ways to create a dict: PyDict_New() is the main C API function, and the tp_new slot maps to dict_new(). In the latter case we can save a little time over what PyDict_New does because it's guaranteed - that the PyDictObject struct is already zeroed out. + that the dictobject struct is already zeroed out. Everyone except dict_new() should use EMPTY_TO_MINSIZE (unless they have an excellent reason not to). */ @@ -186,7 +186,7 @@ /* Dictionary reuse scheme to save calls to malloc, free, and memset */ #define MAXFREEDICTS 80 -static PyDictObject *free_dicts[MAXFREEDICTS]; +static dictobject *free_dicts[MAXFREEDICTS]; static int num_free_dicts = 0; PyObject * @@ -397,7 +397,7 @@ { PyObject *old_value; register dictentry *ep; - typedef PyDictEntry *(*lookupfunc)(PyDictObject *, PyObject *, long); + typedef dictentry *(*lookupfunc)(dictobject *, PyObject *, long); assert(mp-ma_lookup != NULL); ep = mp-ma_lookup(mp, key, hash); @@ -1338,7 +1338,7 @@ int PyDict_Merge(PyObject *a, PyObject *b, int override) { - register PyDictObject *mp, *other; + register dictobject *mp, *other; register Py_ssize_t i; dictentry *entry; @@ -2066,7 +2066,7 @@ assert(type != NULL type-tp_alloc != NULL); self = type-tp_alloc(type, 0); if (self != NULL) { - PyDictObject *d = (PyDictObject *)self; + dictobject *d = (dictobject *)self; /* It's guaranteed that tp-alloc zeroed out the struct. */ assert(d-ma_table == NULL d-ma_fill == 0 d-ma_used == 0); INIT_NONZERO_DICT_SLOTS(d); ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1238] dictobject and dictentry not used consistently in dictobject.c
Guido van Rossum added the comment: I think it would be better to get rid of the typedefs and use the public Py* names everywhere? -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1238 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com