Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set ImportError attributes using _instance_setattr
Subclasses in the wild write `@property` functions that shadow the attributes. Since they are getter only, the builtin attribute setting fails with an `AttributeError`: ``` ====================================================================== ERROR: test_set_path_attr_on_import_error_subclass_with_property_sets_attr (__main__.ExceptionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "library/builtins_test.py", line 4968, in test_set_path_attr_on_import_error_subclass_with_property_sets_attr c = C("a path") File "library/builtins.py", line 1037, in __init__ self.path = path AttributeError: can't set attribute ``` If we use `_instance_setattr`, this works. This may be a more general problem since CPython does all this stuff in C and our builtins are all in Python, but I am not sure how to approach that yet.
- Loading branch information