2006-03-01 02:19:04 -04:00
|
|
|
import weakref
|
|
|
|
|
|
|
|
# http://python.org/sf/1377858
|
2007-01-23 18:41:20 -04:00
|
|
|
# Fixed for new-style classes in 2.5c1.
|
2006-03-01 02:19:04 -04:00
|
|
|
|
|
|
|
ref = None
|
|
|
|
|
|
|
|
def test_weakref_in_del():
|
2007-01-23 18:41:20 -04:00
|
|
|
class Target():
|
2006-03-01 02:19:04 -04:00
|
|
|
def __del__(self):
|
|
|
|
global ref
|
|
|
|
ref = weakref.ref(self)
|
|
|
|
|
|
|
|
w = Target()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_weakref_in_del()
|