[issue8939] Use C type names (PyUnicode etc;) in the C API docs

Marc-Andre Lemburg report at bugs.python.org
Wed Jun 9 11:06:25 CEST 2010


Marc-Andre Lemburg <mal at egenix.com> added the comment:

STINNER Victor wrote:
> 
> STINNER Victor <victor.stinner at haypocalc.com> added the comment:
> 
> Big patch:
>  - replace Python types by C Python types (eg. str => PyUnicodeObject* and None => Py_None)

I was thinking of e.g. "PyUnicode", not "PyUnicodeObject*".

>  - add quotes to the formats, eg. s => "s"

Why do you put the parser codes in double quotes ?

>  - use :ctype: to add links to some terms (eg. Py_BEGIN_ALLOW_THREADS) and use a fixed width font
>  - replace "the default encoding" by "'utf-8' encoding"
>  - replace true by 1, and false by 0 (C API of Python doesn't use stdbool.h but classic int)

That's not necessarily correct: true in C means non-zero. Only
false equates to 0. You can however, make that change if the
function actually does always return 1.

In general, most C functions in Python use these integer
return values:

 1  - success
 0  - no success
 -1 - error

Some of them also return a positive integer >1 for success or
a negative integer <-1 for error, but those are exceptions.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8939>
_______________________________________


More information about the Python-bugs-list mailing list