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

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



# http://python.org/sf/1303614

class Y(object):
    pass

class type_with_modifiable_dict(Y, type):
    pass

class MyClass(object):
    """This class has its __dict__ attribute completely exposed:
    user code can read, reassign and even delete it.
    """
    __metaclass__ = type_with_modifiable_dict


if __name__ == '__main__':
    del MyClass.__dict__  # if we set tp_dict to NULL,
    print MyClass         # doing anything with MyClass segfaults

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.