You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mypyc/test-data/irbuild-classes.test
+157-5Lines changed: 157 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2222,18 +2222,42 @@ class AllowsInterpreted:
2222
2222
def __setattr__(self, attr: str, val: object) -> None: # E: "__setattr__" not supported in class "AllowsInterpreted" because it allows interpreted subclasses
2223
2223
pass
2224
2224
2225
+
def __delattr__(self, attr: str) -> None:
2226
+
pass
2227
+
2225
2228
class InheritsInterpreted(dict):
2226
2229
def __setattr__(self, attr: str, val: object) -> None: # E: "__setattr__" not supported in class "InheritsInterpreted" because it inherits from a non-native class
def __setattr__(self, attr: str, val: object) -> None: # E: "__setattr__" not supported in class "InheritsNonNative" because it inherits from a non-native class
2235
2242
pass
2236
2243
2244
+
def __delattr__(self, attr: str) -> None:
2245
+
pass
2246
+
2247
+
[case testUnsupportedDelAttr]
2248
+
class SetAttr:
2249
+
def __setattr__(self, attr: str, val: object) -> None: # W: Native class "SetAttr" overrides "__setattr__" but not "__delattr__". \
2250
+
At runtime, deleting attributes from this class will likely not work as expected. Consider also defining "__delattr__".
2251
+
pass
2252
+
2253
+
class NoSetAttr:
2254
+
def __delattr__(self, attr: str) -> None: # E: "__delattr__" supported only in classes that also override "__setattr__", or inherit from a native class that overrides it.
0 commit comments