summaryrefslogtreecommitdiffstats
path: root/Lib/_weakrefset.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-26579: Add object.__getstate__(). (GH-2821)Serhiy Storchaka2022-04-061-2/+1
| | | | | | | Copying and pickling instances of subclasses of builtin types bytearray, set, frozenset, collections.OrderedDict, collections.deque, weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes implemented as slots.
* bpo-44962: Fix a race in WeakKeyDict, WeakValueDict and WeakSet when two ↵Thomas Grainger2021-08-281-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | threads attempt to commit the last pending removal (GH-27921) Fixes: Traceback (most recent call last): File "/home/graingert/projects/asyncio-demo/demo.py", line 36, in <module> sys.exit(main()) File "/home/graingert/projects/asyncio-demo/demo.py", line 30, in main test_all_tasks_threading() File "/home/graingert/projects/asyncio-demo/demo.py", line 24, in test_all_tasks_threading results.append(f.result()) File "/usr/lib/python3.10/concurrent/futures/_base.py", line 438, in result return self.__get_result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 390, in __get_result raise self._exception File "/usr/lib/python3.10/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.10/asyncio/runners.py", line 47, in run _cancel_all_tasks(loop) File "/usr/lib/python3.10/asyncio/runners.py", line 56, in _cancel_all_tasks to_cancel = tasks.all_tasks(loop) File "/usr/lib/python3.10/asyncio/tasks.py", line 53, in all_tasks tasks = list(_all_tasks) File "/usr/lib/python3.10/_weakrefset.py", line 60, in __iter__ with _IterationGuard(self): File "/usr/lib/python3.10/_weakrefset.py", line 33, in __exit__ w._commit_removals() File "/usr/lib/python3.10/_weakrefset.py", line 57, in _commit_removals discard(l.pop()) IndexError: pop from empty list Also fixes: Exception ignored in: weakref callback <function WeakKeyDictionary.__init__.<locals>.remove at 0x00007fe82245d2e0> Traceback (most recent call last): File "/usr/lib/pypy3/lib-python/3/weakref.py", line 390, in remove del self.data[k] KeyError: <weakref at 0x00007fe76e8d8180; dead> Exception ignored in: weakref callback <function WeakKeyDictionary.__init__.<locals>.remove at 0x00007fe82245d2e0> Traceback (most recent call last): File "/usr/lib/pypy3/lib-python/3/weakref.py", line 390, in remove del self.data[k] KeyError: <weakref at 0x00007fe76e8d81a0; dead> Exception ignored in: weakref callback <function WeakKeyDictionary.__init__.<locals>.remove at 0x00007fe82245d2e0> Traceback (most recent call last): File "/usr/lib/pypy3/lib-python/3/weakref.py", line 390, in remove del self.data[k] KeyError: <weakref at 0x000056548f1e24a0; dead> See: https://github.com/agronholm/anyio/issues/362#issuecomment-904424310 See also: https://bugs.python.org/issue29519 Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-39481: Make weakref and WeakSet generic (GH-19497)Ethan Smith2020-04-141-0/+3
|
* bpo-36949: Implement __repr__ on WeakSet (GH-13415)Batuhan Taşkaya2019-05-201-0/+3
|
* bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)Jon Dufresne2017-05-181-3/+3
| | | | | | | | * Replaced list(<generator expression>) with list comprehension * Replaced dict(<generator expression>) with dict comprehension * Replaced set(<list literal>) with set literal * Replaced builtin func(<list comprehension>) with func(<generator expression>) when supported (e.g. any(), all(), tuple(), min(), & max())
* bpo-29762: More use "raise from None". (#569)Serhiy Storchaka2017-04-051-1/+1
| | | This hides unwanted implementation details from tracebacks.
* Issue #20006: Fix sporadic failures in test_weakset.Antoine Pitrou2013-12-171-0/+2
|
* Issue #14195: Make WeakSet.__lt__ and WeakSet.__gt__ irreflexive.Meador Inge2012-03-051-6/+6
|
* Fix some set algebra methods of WeakSet objects.Antoine Pitrou2012-03-041-29/+12
|
* Port 2.7 fix for sporadic failure in test_weakset.Antoine Pitrou2012-03-041-5/+2
|
* Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary, ↵Antoine Pitrou2012-03-011-1/+1
| | | | | | | WeakValueDictionary) to return a better approximation when some objects are dead or dying. Moreover, the implementation is now O(1) rather than O(n). Thanks to Yury Selivanov for reporting.
* #10360: catch TypeError in WeakSet.__contains__, just like WeakKeyDictionary ↵Georg Brandl2010-12-031-1/+5
| | | | does.
* Issue #7105: Make WeakKeyDictionary and WeakValueDictionary robust againstAntoine Pitrou2010-01-081-5/+69
| | | | the destruction of weakref'ed objects while iterating.
* Issue 5964: Fixed WeakSet __eq__ comparison to handle non-WeakSet objects.Robert Schuppenies2009-05-171-0/+2
|
* Add a test suite for WeakSet mostly derived from test_set and fix someGeorg Brandl2008-05-181-12/+42
| | | | issues in the weakset implementation discovered with it.
* Fix two issues in the weak set implementation.Georg Brandl2008-05-181-2/+5
|
* Moved WeakSet into a bootstap module use by abc.py.Raymond Hettinger2008-02-051-0/+111
This makes it possible to use ABCs in weakref.py (which will be done in a later checkin).