A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-August/068207.html below:

[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/

[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/ [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/Travis E. Oliphant oliphant.travis at ieee.org
Sat Aug 12 22:16:23 CEST 2006
Neal Norwitz wrote:
> I checked in this fix for the __index__ clipping issue that's been
> discussed.  This patch is an improvement, but still needs some work.
> Please pull out any parts you have an issue with and suggest a patch
> to address your concern.
> 

For me the only remaining concern is that quite often in the code we do this

if (PyIndex_Check(obj)) {
...
	key = PyNumber_Index(obj);
or
  	key_value = PyNumber_AsSize_t(obj, ...)
}
else {remaining checks}


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.

-Travis Oliphant



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4