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.

Author nikratio
Recipients docs@python, georg.brandl, nikratio, terry.reedy
Date 2010-10-16.02:00:12
SpamBayes Score 1.8944735e-07
Marked as misclassified No
Message-id <1287194417.21.0.0527383572279.issue10058@psf.upfronthosting.co.za>
In-reply-to
Content
Georg, this is an important piece of information, but I think it is not yet clearly stated in the documentation. Here is what  http://docs.python.org/c-api/intro.html says about return codes:

"In general, when a function encounters an error, it sets an exception, discards any object references that it owns, and returns an error indicator — usually NULL or -1. A few functions return a Boolean true/false result, with false indicating an error. Very few functions return no explicit error indicator or have an ambiguous return value, and require explicit testing for errors with PyErr_Occurred()."

If this is meant to say that a function returns *only* -1 or NULL in case of an error, *unless documented otherwise* I suggest that the wording be changed to reflect that. Maybe like this:

"In general, when a function encounters an error, it sets an exception, discards any object references that it owns, and returns either NULL or -1 (depending on what is compatible with the function's type). If a functions documentation does not say otherwise, the function can be assumed to follow this convention. Nevertheless, a few functions return a Boolean true/false result, with false indicating an error, and very few functions return no explicit error indicator or have an ambiguous return value, and require explicit testing for errors with PyErr_Occurred()."



Wouldn't that be a reasonable change?
History
Date User Action Args
2010-10-16 02:00:17nikratiosetrecipients: + nikratio, georg.brandl, terry.reedy, docs@python
2010-10-16 02:00:17nikratiosetmessageid: <1287194417.21.0.0527383572279.issue10058@psf.upfronthosting.co.za>
2010-10-16 02:00:14nikratiolinkissue10058 messages
2010-10-16 02:00:12nikratiocreate