| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- weakref.ref and weakref.ReferenceType will become aliases for each
other
- weakref.ref will be a modern, new-style class with proper __new__
and __init__ methods
- weakref.WeakValueDictionary will have a lighter memory footprint,
using a new weakref.ref subclass to associate the key with the
value, allowing us to have only a single object of overhead for each
dictionary entry (currently, there are 3 objects of overhead per
entry: a weakref to the value, a weakref to the dictionary, and a
function object used as a weakref callback; the weakref to the
dictionary could be avoided without this change)
- a new macro, PyWeakref_CheckRefExact(), will be added
- PyWeakref_CheckRef() will check for subclasses of weakref.ref
This closes SF patch #983019.
|
|
|
|
|
| |
Add this default to weakref.WeakValueDictionary.setdefault()
and weakref.WeakKeyDictionary.setdefault() too.
|
|
|
|
|
|
|
|
| |
(Championed by Bob Ippolito.)
The update() method for mappings now accepts all the same argument forms
as the dict() constructor. This includes item lists and/or keyword
arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Someone review this, please! Final releases are getting close, Fred
(the weakref guy) won't be around until Tuesday, and the pre-patch
code can indeed raise spurious RuntimeErrors in the presence of
threads or mutating comparison functions.
See the bug report for my confusions: I can't see any reason for why
__delitem__ iterated over the keys. The new one-liner implementation
is much faster, can't raise RuntimeError, and should be better-behaved
in all respects wrt threads.
New tests test_weak_keyed_bad_delitem and
test_weak_keyed_cascading_deletes fail before this patch.
Bugfix candidate for 2.2.3 too, if someone else agrees with this patch.
|
|
|
|
|
|
|
|
| |
* Adds missing pop() methods to weakref.py
* Expands test suite to broaden coverage of objects with
a mapping interface.
Contributed by Sebastien Keim.
|
| |
|
|
|
|
|
|
|
| |
The WeakKeyDictionary constructor didn't work when a dict arg was
given. Fixed by moving a line. Also adding a unit test.
Bugfix candidate.
|
| |
|
|
|
|
|
|
| |
referencable (weakref.ref() raises TypeError), return 0 instead of
propogating the TypeError.
This closes SF bug #478536; bugfix candidate.
|
|
|
|
| |
It still needs to be here to preserve the API.
|
|
|
|
|
|
|
|
| |
depending on the cycle detector code in the library implementation.
This is a *slightly* different patch than SF patch #417795, but takes
the same approach. (This version avoids calling the __len__() method of
the dict in the remove() functions.)
This closes SF patch #417795.
|
|
|
|
| |
This closes SF bug #458860.
|
|
|
|
| |
for keys that are not in the dictionary.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Weak*Dictionary.update(): No longer create a temporary list to hold the
things that will be stuffed into the underlying dictionary. This had
been done so that if any of the objects used as the weakly-held value
was not weakly-referencable, no updates would take place (TypeError
would be raised). With this change, TypeError will still be raised
but a partial update could occur. This is more like other .update()
implementations.
Thoughout, use of the name "ref" as a local variable has been removed. The
original use of the name occurred when the function to create a weak
reference was called "new"; the overloaded use of the name could be
confusing for someone reading the code. "ref" used as a variable name
has been replaced with "wr" (for 'weak reference').
|
|
|
|
|
|
|
|
| |
parameter.
Weak*Dictionary.get(): Make the second parameter optional.
WeakKeyDictionary.has_key(), .keys(): Make these actually work!
|
| |
|
|
|
|
| |
giving it a slight facelift
|
|
|
|
|
| |
WeakValueDictionary.copy(),
WeakKeyDictionary.copy(): Actually return the copy!
|
| |
|
| |
|
|
|
|
| |
dead references.
|
|
|