File tree Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Original file line number Diff line number Diff line change 25
25
class _HideDeepcopyMeta (type ):
26
26
"""Metaclass that allows conditionally hiding the __deepcopy__ method.
27
27
28
- Set __hide_deepcopy__ to True to hide the __deepcopy__ method,
29
- which will then be looked up in the usual method resolution order.
28
+ Set __hide_deepcopy__ to True to hide the __deepcopy__ method.
30
29
"""
31
30
32
31
def __new__ (cls , name , bases , namespace ):
33
32
orig_ga = namespace .get ("__getattribute__" ) or object .__getattribute__
34
33
35
34
def __getattribute__ (self , attr_name ):
36
35
if attr_name == "__deepcopy__" and orig_ga (self , "__hide_deepcopy__" ):
37
- for base in type (self ).__mro__ [1 :]:
38
- if attr_name in base .__dict__ :
39
- method = base .__dict__ [attr_name ]
40
- return method .__get__ (self , type (self ))
41
36
raise AttributeError (
42
37
f"'{ type (self ).__name__ } ' object has no attribute '{ attr_name } '"
43
38
)
You can’t perform that action at this time.
0 commit comments