File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ RELEASE_TYPE: patch
2+
3+ Fixes a substantial performance regression in stateful tests from computing string representations, present since :ref: `version 6.131.20 <v6.131.20 >`.
Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ def get_pretty_function_description(f: object) -> str:
453453 return pretty (f )
454454 if not hasattr (f , "__name__" ):
455455 return repr (f )
456- name = f .__name__ # type: ignore # validated by hasattr above
456+ name = f .__name__ # type: ignore
457457 if name == "<lambda>" :
458458 return extract_lambda_source (f )
459459 elif isinstance (f , (types .MethodType , types .BuiltinMethodType )):
Original file line number Diff line number Diff line change @@ -504,8 +504,12 @@ def __post_init__(self):
504504 self .bundles = tuple (bundles )
505505
506506 def __repr__ (self ) -> str :
507- rep = get_pretty_function_description
508- bits = [f"{ k } ={ rep (v )} " for k , v in dataclasses .asdict (self ).items () if v ]
507+ bits = [
508+ f"{ field .name } ="
509+ f"{ get_pretty_function_description (getattr (self , field .name ))} "
510+ for field in dataclasses .fields (self )
511+ if getattr (self , field .name )
512+ ]
509513 return f"{ self .__class__ .__name__ } ({ ', ' .join (bits )} )"
510514
511515
You can’t perform that action at this time.
0 commit comments