Issue21173
Created on 2014-04-07 20:17 by pjenvey, last changed 2014-10-05 18:10 by python-dev. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue21173-test.diff | pjenvey, 2014-04-07 20:18 | review | ||
| weakdictlen.patch | pitrou, 2014-10-04 21:05 | |||
| Messages (3) | |||
|---|---|---|---|
| msg215716 - (view) | Author: Philip Jenvey (pjenvey) * | Date: 2014-04-07 20:17 | |
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 |
|||
| msg228495 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2014-10-04 21:05 | |
Thank you for reporting this. Here is a patch with tests. |
|||
| msg228606 - (view) | Author: Roundup Robot (python-dev) | Date: 2014-10-05 18:10 | |
New changeset 657d21b4b121 by Antoine Pitrou in branch '3.4': Closes #21173: Fix len() on a WeakKeyDictionary when .clear() was called with an iterator alive. https://hg.python.org/cpython/rev/657d21b4b121 New changeset 27533444b964 by Antoine Pitrou in branch 'default': Closes #21173: Fix len() on a WeakKeyDictionary when .clear() was called with an iterator alive. https://hg.python.org/cpython/rev/27533444b964 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-10-05 18:10:44 | python-dev | set | status: open -> closed nosy:
+ python-dev resolution: fixed |
| 2014-10-04 21:05:52 | pitrou | set | files:
+ weakdictlen.patch stage: patch review |
| 2014-04-07 20:18:22 | pjenvey | set | files:
+ issue21173-test.diff keywords: + patch |
| 2014-04-07 20:17:27 | pjenvey | create | |