[ python-Bugs-1511381 ] codec_getstreamcodec passes extra None

SourceForge.net noreply at sourceforge.net
Fri Jun 23 17:47:34 CEST 2006


Bugs item #1511381, was opened at 2006-06-23 17:00
Message generated for change (Settings changed) made by doerwalter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1511381&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unicode
Group: Python 2.5
Status: Open
Resolution: None
Priority: 6
Submitted By: Hye-Shik Chang (perky)
>Assigned to: Hye-Shik Chang (perky)
Summary: codec_getstreamcodec passes extra None

Initial Comment:
codec_getstreamcodec passes a None object (null
pointer, originally) as a "error" argument when errors
is given as a null pointer.  Due to this behavior,
parsers can't utilize cjkcodecs which doesn't allow
None as a default argument:

SyntaxError: encoding problem: with BOM

Attached patch fixes it to omit the argument, "errors",
and changed it to use PyObject_CallFunction instead of
PyEval_CallFunction because PyEval_CallFunction doesn't
work for simple "O" argument. (I don't know it was
intended. But we can still use PyEval_CallFunction if
we write it as "(O)")  I wonder if there's a reason
that you chose PyEval_CallFunction for the
initialization order or something?


How to reproduce the error:

echo "# coding: cp949" > test.py
./python test.py


----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2006-06-23 17:47

Message:
Logged In: YES 
user_id=89016

The patch looks good to me. Switching from
PyEval_CallFunction() to PyObject_CallFunction() should be
OK. (There seems to be subtle differences between the two,
but finding out what it is looks like a scavenger hunt to me
:-/)).

So go ahead and check it in.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1511381&group_id=5470


More information about the Python-bugs-list mailing list