Author loewis
Date 2006-05-12.20:32:34
SpamBayes Score
Marked as misclassified
Logged In: YES 

I understand your request, and I sympathize with it
(although I would call the macro Py_ssize_t_defined).

However, I find it equally important that the other issue
gets understood, as well. The macros are not necessary for
portable code, and they never were.

They were introduced for convenience only, so that you can
have the actual type name for the self parameter (e.g.
FooObject* instead of PyObject*). If the signatures are
corrected to have PyObject* as their first parameter, the
casts *should* become unnecessary. If they are then still
required, that indicates a serious programming error.

The evilness of these casts comes from the fact that they
can silence warnings that would point to severe type errors
if the cast wouldn't silence them. For example, if the
parameter order or the number is wrong for one of these
functions, the compiler won't notice because of the cast.
The cast is only there to convert the first parameter
(self), yet it can manage to convert any other parameter, as

So getting these function pointers type correct not only
increases portabiltiy in the presence of Py_ssize_t, but
also improves correctness and readability of the code.
Date User Action Args
2008-01-20 09:59:46adminlinkissue1485576 messages
2008-01-20 09:59:46admincreate