[Python-Dev] Fwd: [Python-checkins] r51236 - in python/trunk: Doc/api/abstract.tex Include/abstract.h Include/object.h Lib/test/test_index.py Misc/NEWS Modules/arraymodule.c Modules/mmapmodule.c Modules/operator.c Objects/abstract.c Objects/classobject.c Objects/
Nick Coghlan
ncoghlan at gmail.com
Sun Aug 13 08:31:06 CEST 2006
Travis E. Oliphant wrote:
> Internally PyNumber_AsSize_t makes a call to PyNumber_Index, and
> PyNumber_Index also calls the PyIndex_Check as well . So, basically we
> end up calling PyIndex_Check(obj) 2 times when only one check should be
> necessary.
>
> This code could be re-written to move any other type checks first and
> replace the PyIndex_Check(obj) code with PyNumber_Index(obj) and error
> handling but I'm not sure if that's the right way to go or if it's worth
> it.
This concern was what lead me up the garden path with the more complicated C
API in my patch. I've since become convinced that compared to everything else
going on, the repetition of the 3 not-NULL checks performed by that macro
really isn't worth worrying about (particularly at this stage of the release
cycle).
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-Dev
mailing list