[Python-Dev] check for PyUnicode_READY look backwards

Benjamin Peterson benjamin at python.org
Thu Oct 6 22:47:22 CEST 2011


Amaury Forgeot d'Arc <amauryfa <at> gmail.com> writes:

> I'd prefer it was written :
>        if (PyUnicode_READY(*filename) < 0)
> because "< 0" clearly indicates an error condition.

Why not just have it return 0 on error? This would be more consistent with API
functions that return "false" values like NULL and would just be

if (!PyUnicode_READY(s)) return NULL;

in code.

Regards,
Benjamin






More information about the Python-Dev mailing list