Hi Martin, On Thu, Dec 29, 2005 at 03:04:30PM +0100, "Martin v. L?wis" wrote: > New conversion functions PyInt_FromSsize_t, PyInt_AsSsize_t, > PyLong_AsSsize_t are introduced. PyInt_FromSsize_t will transparently > return a long int object if the value exceeds the MAX_INT.
I guess you mean LONG_MAX instead of MAX_INT, in the event that ssize_t is larger than a long. Also, distinguishing between PyInt_AsSsize_t() and PyLong_AsSsize_t() doesn't seem to be useful (a quick look in your branch makes me guess that they both accept an int or a long object anyway). > The conversion codes 's#' and 't#' will output Py_ssize_t > if the macro PY_SIZE_T_CLEAN is defined before Python.h > is included, and continue to output int if that macro > isn't defined. Hum. It would be much cleaner to introduce a new format character to replace '#' and deprecate '#'... > Compatibility with previous Python > versions can be achieved with the test:: > > #if PY_VERSION_HEX < 0x02050000 > typedef int Py_ssize_t; > #endif > > and then using Py_ssize_t in the rest of the code. Nice trick :-) As far as I can tell you have done as much as possible to ensure compatibility, short of adding new slots duplicating the existing ones with the new signature -- which would make abstract.c/typeobject.c a complete nightmare. I'm +1 on doing this in 2.5. A bientot, Armin _______________________________________________ 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