This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyString_AsStringAndSize() return value documented wrong
Type: Stage:
Components: Documentation Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, georg.brandl, gnbond
Priority: normal Keywords:

Created on 2005-09-28 03:37 by gnbond, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg26415 - (view) Author: Gregory Bond (gnbond) Date: 2005-09-28 03:37
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;
                }
msg26416 - (view) Author: Gregory Bond (gnbond) Date: 2005-09-28 06:05
Logged In: YES 
user_id=293157

Fix the summary!
msg26417 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-28 12:53
Logged In: YES 
user_id=1188172

Thanks for the report, fixed in Doc/api/concrete.tex r1.67,
1.58.2.4.
History
Date User Action Args
2022-04-11 14:56:13adminsetgithub: 42423
2005-09-28 03:37:02gnbondcreate