File tree 1 file changed +14
-11
lines changed
1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change 18
18
timezone ,
19
19
)
20
20
from typing import (
21
+ TYPE_CHECKING ,
21
22
Any ,
22
23
Callable ,
23
24
Dict ,
@@ -693,18 +694,20 @@ def __repr__(self) -> str:
693
694
]
694
695
return f"{ self .__class__ .__name__ } ({ ', ' .join (parts )} )"
695
696
696
- def __getattribute__ (self , name : str ) -> Any :
697
- """
698
- Lazily initialize default values to avoid infinite recursion for recursive
699
- message types
700
- """
701
- value = super ().__getattribute__ (name )
702
- if value is not PLACEHOLDER :
703
- return value
697
+ if not TYPE_CHECKING :
704
698
705
- value = self ._get_field_default (name )
706
- super ().__setattr__ (name , value )
707
- return value
699
+ def __getattribute__ (self , name : str ) -> Any :
700
+ """
701
+ Lazily initialize default values to avoid infinite recursion for recursive
702
+ message types
703
+ """
704
+ value = super ().__getattribute__ (name )
705
+ if value is not PLACEHOLDER :
706
+ return value
707
+
708
+ value = self ._get_field_default (name )
709
+ super ().__setattr__ (name , value )
710
+ return value
708
711
709
712
def __setattr__ (self , attr : str , value : Any ) -> None :
710
713
if attr != "_serialized_on_wire" :
You can’t perform that action at this time.
0 commit comments