Hi Ero, Thanks for these! I checked them in.
The datetime patch had a few problems (did you run the unit test?) that I got rid of. The function you were looking for does exist, it's PyUnicode_AsUTF8String(). (which returns a new object instead of a borrowed reference). I changed your code to use this. I changed a few places from PyBuffer_FromStringAndSize("", 1) to <ditto>("", 0) -- the bytes object always allocates an extra null byte that isn't included in the count. I changed a few places from using strlen() to using the PyBuffer_GET_SIZE() macro. PyBuffer_AS_STRING() can be NULL if the size is 0; I rearranged some code to avoid asserts triggering in this case. There are still two remaining problems: test_datetime leaks a bit (49 references) and test_strptime ands test_strftime leak a lot (over 2000 references!). We can hunt these down tomorrow. --Guido On 8/23/07, Ero Carrera <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm attaching a small patch result of attempting to tackle part of > one of the tasks in the Google Sprint. > The patch removes most of the references of PyString_* calls in the > "time" and "datetime" modules and adds Unicode support instead. > > There's a problem in "datetime" with > "_PyUnicode_AsDefaultEncodedString". As there's no current equivalent > that would provide an object of type "bytes", there are two > occurrences of PyString_* functions to handle the returned "default > encoded string" and convert it into bytes. > > cheers, > -- > Ero > > > > _______________________________________________ > Python-3000 mailing list > Python-3000@python.org > http://mail.python.org/mailman/listinfo/python-3000 > Unsubscribe: > http://mail.python.org/mailman/options/python-3000/guido%40python.org > > > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com