[Python-Dev] check for PyUnicode_READY look backwards (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Fri Oct 7 15:21:36 CEST 2011


if (!PyUnicode_READY(foo)) is not better, also because of PyUnicodeISREADY(foo).

I prefer PyUnicodeISREADY(foo) < 0 over PyUnicodeISREADY(foo) == -1.

Ok, so feel free to replace all == -1 tests with < 0 tests as well.

I'll point out that the test for -1 is also widespread in Python, e.g. when checking return values from PyObject_SetAttrString, BaseException_init, PyThread_create_key, PyObject_DelAttrString, etc.

Regards, Martin



More information about the Python-Dev mailing list