[issue15402] Correct __sizeof__ support for struct

Mark Dickinson report at bugs.python.org
Wed Jul 25 12:29:12 CEST 2012


Mark Dickinson <dickinsm at gmail.com> added the comment:

> The compiler has no chance to find out. You cast the pointer to
> PyCFunction, telling the compiler that it really is a PyCFunction.

True; I was thinking that the compiler should have the necessary information to warn about the suspicious (PyCFunction) cast.  But then again the function pointer cast is perfectly legal---it's the subsequent call that invokes undefined behaviour, and that's in a different file, so the compiler can't help.

> "Everywhere" is nowhere close to the truth.

Yep, sorry;  bad wording on my part.  I didn't intend to imply that all uses of METH_NOARGS had this problem.  'Everywhere' for very small values of 'everywhere'. :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15402>
_______________________________________


More information about the Python-bugs-list mailing list