[ python-Bugs-805015 ] PyUnicode_FromEncodedObject
SourceForge.net
noreply at sourceforge.net
Wed Jun 14 18:46:57 CEST 2006
Bugs item #805015, was opened at 2003-09-12 11:39
Message generated for change (Settings changed) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=805015&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: None
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: David Abrahams (david_abrahams)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyUnicode_FromEncodedObject
Initial Comment:
There's a bug, either in the code or docs for
PyUnicode_FromEncodedObject. The docs read:
"Unicode objects are passed back as-is with
incremented
refcount. Note: These cannot be decoded; passing a
non-NULL value
for encoding will result in a TypeError."
'tain't so; the following shows that the error is
unconditional.
if (obj == NULL) {
PyErr_BadInternalCall();
return NULL;
}
#if 0
/* For b/w compatibility we also accept Unicode
objects provided
that no encodings is given and then redirect to
PyObject_Unicode() which then applies the
additional logic for
Unicode subclasses.
NOTE: This API should really only be used for
object which
represent *encoded* Unicode !
*/
if (PyUnicode_Check(obj)) {
if (encoding) {
PyErr_SetString(PyExc_TypeError,
"decoding Unicode
is not supported");
return NULL;
}
return PyObject_Unicode(obj);
}
#else
if (PyUnicode_Check(obj)) {
PyErr_SetString(PyExc_TypeError,
"decoding Unicode is not
supported");
return NULL;
}
#endif
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2006-06-14 16:46
Message:
Logged In: YES
user_id=849994
Fixed in rev. 46961.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=805015&group_id=5470
More information about the Python-bugs-list
mailing list