Armin Rigo wrote:
> This would do the right thing for <= 2.4, using ints everywhere; and the
> Python.h version 2.5 would detect the #define and assume it's a
> 2.5-compatible module, so it would override the #define with the real
> thing *and* turn on the ssize_t interpretation of the '#' format
> character.

This would be very similar to the PY_SIZE_T_CLEAN approach, except
that it would also help to detect spelling mistakes.

>From an implementation point of view, the real challenge is to
give PyArg_ParseTuple a different meaning; I do this be #defining
it to PyArg_ParseTupleSsize_t (to preserve binary compatibility
for the original interpretation of ParseTuple). Putting
additional flags arguments in the entire code is also quite
hackish.

> I still don't like the idea of a magic #define that changes the behavior
> of '#include <Python.h>', but I admit I don't find any better solution.
> I suppose I'll just blame C.

More precisely, the printf style of function calling, and varargs
functions. ISO C is pretty type safe, but with varargs functions,
you lose that completely.

I still hope I can write a C parser some day that does
ParseTuple/BuildValue checking.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to