[Python-checkins] python/dist/src/Objects longobject.c,1.148,1.149

Tim Peters tim_one@email.msn.com
Sat, 1 Feb 2003 18:58:20 -0500


>> + _PyLong_Sign(PyObject *vv)
>> + {
>> + 	PyLongObject *v = (PyLongObject *)vv;
>> + 	const int ndigits = v->ob_size;
>> +
>> + 	assert(v != NULL);

[Neal Norwitz]
> Not sure how useful this assert is since v was already
> dereferenced on the line above (v->ob_size).

Its only use is to the human reader, who, when this blows up, looks at the
code.  Then the assert() clearly communicates that v != NULL is a
precondition for calling this internal API function.  If the assert()
weren't there, the reader would have to guess  (or read the comment before
the declaration in the .h file -- but that's too much to ask <wink>).