[ python-Bugs-1306449 ] PyString_AsStringAndSize() return value documented wroing

SourceForge.net noreply at sourceforge.net
Wed Sep 28 05:37:03 CEST 2005


Bugs item #1306449, was opened at 2005-09-28 13:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1306449&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: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Gregory Bond (gnbond)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyString_AsStringAndSize() return value documented wroing

Initial Comment:
The C/C++ API document (latest version from docs.python.org) has:

	int PyString_AsStringAndSize(	PyObject *obj, char **buffer, int 
*length)
	[snip]

 	If string is not a string object at all, PyString_AsString() returns NULL 
and raises TypeError.

But the code returns -1 (Objects/stringobject.c line 728ff in my 2.3.4 
source):

                {
                        PyErr_Format(PyExc_TypeError,
                                     "expected string or Unicode object, "
                                     "%.200s found", obj->ob_type->tp_name);
                        return -1;
                }


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

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


More information about the Python-bugs-list mailing list