File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 2525from typing import Union
2626
2727from ._result import Result
28+ from ._tracing import saferepr
2829
2930
3031_T = TypeVar ("_T" )
@@ -456,7 +457,7 @@ def _add_hookimpl(self, hookimpl: HookImpl) -> None:
456457 self ._hookimpls .insert (i + 1 , hookimpl )
457458
458459 def __repr__ (self ) -> str :
459- return f"<HookCaller { self .name !r } >"
460+ return f"<HookCaller { saferepr ( self .name ) } >"
460461
461462 def _verify_all_args_are_provided (self , kwargs : Mapping [str , object ]) -> None :
462463 # This is written to avoid expensive operations when not needed.
@@ -609,7 +610,7 @@ def _call_history(self) -> _CallHistory | None: # type: ignore[override]
609610 return self ._orig ._call_history
610611
611612 def __repr__ (self ) -> str :
612- return f"<_SubsetHookCaller { self .name !r } >"
613+ return f"<_SubsetHookCaller { saferepr ( self .name ) } >"
613614
614615
615616@final
@@ -667,7 +668,7 @@ def __init__(
667668 self .trylast : Final = hook_impl_opts ["trylast" ]
668669
669670 def __repr__ (self ) -> str :
670- return f"<HookImpl plugin_name={ self .plugin_name !r } , plugin={ self .plugin !r } >"
671+ return f"<HookImpl plugin_name={ saferepr ( self .plugin_name ) } , plugin={ saferepr ( self .plugin ) } >"
671672
672673
673674@final
Original file line number Diff line number Diff line change 99from pluggy ._callers import _multicall
1010from pluggy ._hooks import HookImpl
1111
12+ from ._tracing import saferepr
13+
1214
1315hookspec = HookspecMarker ("example" )
1416hookimpl = HookimplMarker ("example" )
@@ -77,7 +79,7 @@ def __init__(self, num: int) -> None:
7779 self .num = num
7880
7981 def __repr__ (self ) -> str :
80- return f"<Plugin { self .num } >"
82+ return f"<Plugin { saferepr ( self .num ) } >"
8183
8284 @hookimpl
8385 def fun (self , hooks , nesting : int ) -> None :
@@ -89,7 +91,7 @@ def __init__(self, num: int) -> None:
8991 self .num = num
9092
9193 def __repr__ (self ) -> str :
92- return f"<PluginWrap { self .num } >"
94+ return f"<PluginWrap { saferepr ( self .num ) } >"
9395
9496 @hookimpl (wrapper = True )
9597 def fun (self ):
You can’t perform that action at this time.
0 commit comments