[issue15402] Correct __sizeof__ support for struct
Meador Inge
report at bugs.python.org
Tue Jul 24 03:05:21 CEST 2012
Meador Inge <meadori at gmail.com> added the comment:
On Mon, Jul 23, 2012 at 5:04 PM, Martin v. Löwis <report at bugs.python.org> wrote:
> The patch that Meador committed is incorrect: METH_NOARGS functions
> still take a PyObject* args argument, which will be NULL. I'm puzzled, as
> Serhiy's original patch was correct.
I almost committed the two-argument version with the 'unused' parameter, but
then I had the bright idea to look at how '__sizeof__' is implemented elsewhere
in the interpreter:
static PyObject *
list_sizeof(PyListObject *self);
static PyObject *
dict_sizeof(PyDictObject *mp);
static PyObject *
set_sizeof(PySetObject *so);
etc ...
So I dropped the 'unused' parmeter for the 'struct' implementation:
static PyObject *
s_sizeof(PyStructObject *self);
I will happily fix it, but if it is wrong one place, then it is wrong
everywhere.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15402>
_______________________________________
More information about the Python-bugs-list
mailing list