Author pjenvey
Recipients pitrou, pjenvey
Date 2014-04-07.20:17:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396901847.85.0.817641964544.issue21173@psf.upfronthosting.co.za>
In-reply-to
Content
len() on WeakKeyDictionarys can fail with ValueErrors when _IterationGuards are kept alive

Attached is a test showing this:

======================================================================
ERROR: test_weak_keys_len_destroy_while_iterating (__main__.MappingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_weakref.py", line 1336, in test_weak_keys_len_destroy_while_iterating
    self.assertEqual(len(dict), 0)
ValueError: __len__() should return >= 0


One probably shouldn't keep them alive like this, but __len__ shouldn't be blowing up either. On non ref counting GC platforms this situation is easier to trigger unintentionally
History
Date User Action Args
2014-04-07 20:17:27pjenveysetrecipients: + pjenvey, pitrou
2014-04-07 20:17:27pjenveysetmessageid: <1396901847.85.0.817641964544.issue21173@psf.upfronthosting.co.za>
2014-04-07 20:17:27pjenveylinkissue21173 messages
2014-04-07 20:17:27pjenveycreate