[Python-3000] py3k conversion docs?
Adam Hupp
adam at hupp.org
Sun Aug 5 18:31:32 CEST 2007
On Sat, Aug 04, 2007 at 04:06:30PM -0500, skip at pobox.com wrote:
> I'm looking at the recently submitted patch for the csv module and am
> scratching my head a bit trying to understand the code transformations.
> I've not looked at any py3k code yet, so this is all new to me. Is there
> any documentation about the Py3k conversion? I'm particularly interested in
> the string->unicode conversion.
>
> Here's one confusing conversion. I see PyString_FromStringAndSize replaced
> by PyUnicode_FromUnicode.
In that case the type of ReaderObj.field has changed from char* to
Py_UNICODE*. _FromUnicode should be analagous to the
_FromStringAndSize call here.
> In another place I see PyString_FromString replaced by
> PyUnicodeDecodeASCII. In some places I see a char left alone. In
> other places I see it replaced by PyUNICODE.
Actually, I missed one spot that should use Py_UNICODE instead of
char. get_nullchar_as_None should be taking a Py_UNICODE instead of a
char, and PyUnicode_DecodeASCII should really be a call to
_FromUnicode.
I'll say though that I'm not positive this patch is the Right Way to
do the conversion. Review by someone that does would be appreciated.
--
Adam Hupp | http://hupp.org/adam/
More information about the Python-3000
mailing list