[Python-Dev] int vs ssize_t in unicode

Neal Norwitz nnorwitz at gmail.com
Thu Apr 13 09:00:43 CEST 2006


On 4/12/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>
> > 235:
> >         assert(length<INT_MAX);
> >     unicode->length = (int)length;
>
> Right: I just changed it. It may date back to a version of the patch
> where I only changed the signatures of the functions, but not the
> object layout.

I just grepped for INT_MAX and there's a ton of them still (well 83 in
*/*.c).  Some aren't an issue like posixmodule.c, those are
_SC_INT_MAX.  marshal is probably ok, but all uses should be verified.
 Really all uses of {INT,LONG}_{MIN,MAX} should be verified and
converted to PY_SSIZE_T_{MIN,MAX} as appropriate.

There are only a few {INT,LONG}_MIN and 22 LONG_MAX.

I'll try to review these soon unless someone beats me to it.

n


More information about the Python-Dev mailing list