New submission from Nikolaus Rath <nikol...@rath.org>:

http://docs.python.org/c-api/string.html says about the return value of 
AsStringAndSize:

"If length is NULL, the resulting buffer may not contain NUL characters; if it 
does, the function returns -1 and a TypeError is raised."

"If string is not a string object at all, PyString_AsStringAndSize() returns -1 
and raises TypeError."

This makes me wonder what the return code is if a) the function succeeds and b) 
it encounteres some other problem (i.e. out of memory when it tries to encode a 
unicode string into its default encoding).

I guess that the return value is 0 on success and -1 on all errors, but it 
would be nice if the documentation would be clear about this.

----------
assignee: d...@python
components: Documentation
messages: 118294
nosy: Nikratio, d...@python
priority: normal
severity: normal
status: open
title: Unclear PyString_AsStringAndSize return value
type: feature request
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10058>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to