[Pyrex] pyrex bug: dict del with C int key doesn't work

C. Titus Brown ctb at msu.edu
Sat Oct 25 05:07:52 CEST 2008


Hi all,

over in pygr-dev, we noticed an odd error that I tracked down to pyrex:

  http://groups.google.com/group/pygr-dev/browse_thread/thread/123a4a6b92d7abe8

Briefly, in pyrex release 0.9.7 and up, 

	cdef int key

	key = 0

	d = {}
	d[key]
	del d[key]

fails with the error

  TypeError: 'dict' object doesn't support item deletion

which is of course absurd :)

Looking at CHANGES.txt, this looks like yet another bug linked to
optimization of indexing maps using a C integer (see 0.9.7.1 and .2
release notes).

There are two possible interim fixes: first, you can not declare 'key'
as a C int, or second, you can just use __delitem__ directly.  But
ultimately, of course, it'd be nice to get this fixed in pyrex!

I've attached a .tar.gz containing code demonstrating the bug.  Please
let me know if there's anything else I can do!

cheers,
--titus
-- 
C. Titus Brown, ctb at msu.edu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyrex-delint-bug.tar.gz
Type: application/octet-stream
Size: 544 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20081025/c417f142/attachment-0001.obj 


More information about the Pyrex mailing list