> (gdb) p *self->ob_type->tp_as_mapping > $2 = {mp_length = 0x4006eb7c <_ndarray_length>, mp_subscript = 0x80669b8 > <slot_mp_subscript>, > mp_ass_subscript = 0x80669e0 <slot_mp_ass_subscript>} > > Looking at the same code compiled for Python-2.3, _ndarray "owns" all of > the mapping protocol slots, which is what I really want to happen: > > (gdb) p *o->ob_type->tp_as_mapping > $1 = {mp_length = 0x400c1a68 <_ndarray_length>, mp_subscript = > 0x400c1a80 <_ndarray_subscript>, mp_ass_subscript = 0x400c1188 > <_ndarray_ass_subscript>} > > Did anything change between Python-2.2.1 and Python-2.3 that would > account for this? Yes, I did several massive refactorings of a lot of very subtle code in typeobject.c. Note that this is only a performance improvement, not a semantic change: slot_mp_subscript will look for and call the __setitem__ descriptor in the type dict, which will be a Python wrapper around _ndarray_subscript. The new code notices that this is so and leaves _ndarray_subscript in the slot. I wish it was easy to backport this to 2.2.2, but it's not. :-( --Guido van Rossum (home page: http://www.python.org/~guido/)
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