Re: [Python-Dev] New PEP: Using ssize_t as the index type
by "Martin v. Löwis" other posts by this author
Jan 5 2006 12:41PM messages near this date
Re: [Python-Dev] New PEP: Using ssize_t as the index type
|
Re: [Python-Dev] New PEP: Using ssize_t as the index type
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@[...].org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev-ml%40activestate.c
om
Thread:
"Martin v. Löwis"
Travis E. Oliphant
"Martin v. Löwis"
Brett Cannon
Fredrik Lundh
"Martin v. Löwis"
Tim Peters
"Martin v. Löwis"
Armin Rigo
"Martin v. Löwis"
Armin Rigo
"Martin v. Löwis"
M.-A. Lemburg
Neal Norwitz
"Martin v. Löwis"
M.-A. Lemburg
"Martin v. Löwis"
M.-A. Lemburg
"Martin v. Löwis"
M.-A. Lemburg
"Martin v. Löwis"
Tim Peters
"Martin v. Löwis"
Michael Urman
Neal Norwitz
Aahz
"Martin v. Löwis"
Guido van Rossum
|