[issue14159] __len__ method of weakset

2012-03-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: 2.7 didn't have the weak dict issue, but I still backported the tests there. Closing, should be fixed now. Thanks for reporting! -- resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed _

[issue14159] __len__ method of weakset

2012-03-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset b6acfbe2bdbe by Antoine Pitrou in branch '2.7': Issue #14159: Fix the len() of weak sets to return a better approximation when some objects are dead or dying. http://hg.python.org/cpython/rev/b6acfbe2bdbe -- __

[issue14159] __len__ method of weakset

2012-03-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1cd0688ff004 by Antoine Pitrou in branch '3.2': Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary, WeakValueDictionary) to return a better approximation when some objects are dead or dying. http://hg.python.org/cpython/rev

[issue14159] __len__ method of weakset

2012-03-01 Thread Yury Selivanov
Yury Selivanov added the comment: As expected, it seems that the patch fixes the issue. -- ___ Python tracker ___ ___ Python-bugs-lis

[issue14159] __len__ method of weakset

2012-02-29 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- priority: normal -> high ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue14159] __len__ method of weakset

2012-02-29 Thread Yury Selivanov
Yury Selivanov added the comment: Yes, I couldn't reproduce it either. However it frequently occurs on our buildbot, so tomorrow I'll give you an update if this patch resolves the issue or not. In any way, your patch fixes the current implementation at least from the performance perspective

[issue14159] __len__ method of weakset

2012-02-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: New patch addressing similar issue with weak dicts, and adding more tests. -- Added file: http://bugs.python.org/file24683/weaksetlen2.patch ___ Python tracker ___

[issue14159] __len__ method of weakset

2012-02-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: I can't find a way to reproduce as a unit test. Here is a patch making __len__ O(1) as well (instead of O(n)). Could you try it? (note : AFAICT, a similar issue exists for weak dicts) -- stage: -> needs patch versions: +Python 2.7 Added file: http://b

[issue14159] __len__ method of weakset

2012-02-29 Thread Yury Selivanov
New submission from Yury Selivanov : WeakSet has a bug in its '__len__' method, where it performs iteration though 'self.data' without ensuring _IterationGuard. This leads to some hard to catch errors with the following traceback: builtins.RuntimeError: Set changed size during iteration