Commit 1bb8cbcd authored by Georg Brandl's avatar Georg Brandl

bug [ 1228904 ] weakref example broken

parent 51df092e
......@@ -255,13 +255,10 @@ returned when the referent is accessed:
import weakref
class ExtendedRef(weakref.ref):
def __new__(cls, ob, callback=None, **annotations):
weakref.ref.__new__(cls, ob, callback)
self.__counter = 0
def __init__(self, ob, callback=None, **annotations):
super(ExtendedRef, self).__init__(ob, callback)
for k, v in annotations:
self.__counter = 0
for k, v in annotations.iteritems():
setattr(self, k, v)
def __call__(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment