[Python-Dev] Identifier API

Hrvoje Niksic hrvoje.niksic at avl.com
Tue Oct 11 16:24:01 CEST 2011


On 10/11/2011 02:45 PM, Amaury Forgeot d'Arc wrote:
> It should also check for errors; in this case the initialization is a
> bit more verbose:
> if (PY_IDENTIFIER_INIT(update) < 0)
> <return NULL or return -1 or goto error>;

Error checking is somewhat more controversial because behavior in case 
of error differs between situations and coding patterns.  I think it 
should be up to the calling code to check for s_update remaining NULL. 
In my example, I would expect PyObject_CallMethodObj and similar to 
raise InternalError when passed a NULL pointer.  Since their return 
values are already checked, this should be enought to cover the unlikely 
case of identifier creation failing.

Hrvoje


More information about the Python-Dev mailing list