mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Fix SF 762891: "del p[key]" on proxy object raises SystemError()
This commit is contained in:
parent
562a855da0
commit
d693a81595
3 changed files with 49 additions and 1 deletions
|
@ -226,6 +226,17 @@ class ReferencesTestCase(TestBase):
|
|||
self.assert_(not hasattr(o, 'foo'),
|
||||
"object does not reflect attribute removal via proxy")
|
||||
|
||||
def test_proxy_deletion(self):
|
||||
# Test clearing of SF bug #762891
|
||||
class Foo:
|
||||
result = None
|
||||
def __delitem__(self, accessor):
|
||||
self.result = accessor
|
||||
g = Foo()
|
||||
f = weakref.proxy(g)
|
||||
del f[0]
|
||||
self.assertEqual(f.result, 0)
|
||||
|
||||
def test_getweakrefcount(self):
|
||||
o = C()
|
||||
ref1 = weakref.ref(o)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue