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.000000000 +0200
+++ ./dictobject.c 2007-10-05 09:19:33.000000000 +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