Michael Hudson wrote: > "Travis E. Oliphant" <oliphant.travis at ieee.org> writes: > >> I'm seeing strange behavior in the Python 2.5a0 trunk that is causing >> the tests for numpy to fail. Apparently obj[...] = 1 is not calling >> PyObject_SetItem >> >> Here is a minimal example to show the error. Does anyone else see this? >> >> class temp(object): >> def __setitem__(self, obj, v): >> print obj, v >> >> mine = temp() >> mine[...] = 1 > > It's a compiler problem: > >>>> dis.dis(compile("mine[...] = 1", '', 'single')) > 1 0 LOAD_CONST 0 (1) > 3 LOAD_NAME 0 (mine) > 6 LOAD_CONST 1 (Ellipsis) > 9 LOAD_CONST 2 (None) > 12 RETURN_VALUE And how... case Ellipsis_kind: ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts) break; Just a couple of minor details missing, like, oh, compiling the actual subscript operation :) Bug here: http://www.python.org/sf/1448804 (assigned to myself, since I already wrote a test for it and worked out where to fix it) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
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