Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/test/crashers/borrowed_ref_1.py

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


"""
_PyType_Lookup() returns a borrowed reference.
This attacks the call in dictobject.c.
"""

class A(object):
    pass

class B(object):
    def __del__(self):
        print 'hi'
        del D.__missing__

class D(dict):
    class __missing__:
        def __init__(self, *args):
            pass


d = D()
a = A()
a.cycle = a
a.other = B()
del a

prev = None
while 1:
    d[5]
    prev = (prev,)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].