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 25
25
from typing import Union
26
26
27
27
from ._result import Result
28
+ from ._tracing import saferepr
28
29
29
30
30
31
_T = TypeVar ("_T" )
@@ -456,7 +457,7 @@ def _add_hookimpl(self, hookimpl: HookImpl) -> None:
456
457
self ._hookimpls .insert (i + 1 , hookimpl )
457
458
458
459
def __repr__ (self ) -> str :
459
- return f"<HookCaller { self .name !r } >"
460
+ return f"<HookCaller { saferepr ( self .name ) } >"
460
461
461
462
def _verify_all_args_are_provided (self , kwargs : Mapping [str , object ]) -> None :
462
463
# This is written to avoid expensive operations when not needed.
@@ -609,7 +610,7 @@ def _call_history(self) -> _CallHistory | None: # type: ignore[override]
609
610
return self ._orig ._call_history
610
611
611
612
def __repr__ (self ) -> str :
612
- return f"<_SubsetHookCaller { self .name !r } >"
613
+ return f"<_SubsetHookCaller { saferepr ( self .name ) } >"
613
614
614
615
615
616
@final
@@ -667,7 +668,7 @@ def __init__(
667
668
self .trylast : Final = hook_impl_opts ["trylast" ]
668
669
669
670
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 ) } >"
671
672
672
673
673
674
@final
Original file line number Diff line number Diff line change 9
9
from pluggy ._callers import _multicall
10
10
from pluggy ._hooks import HookImpl
11
11
12
+ from ._tracing import saferepr
13
+
12
14
13
15
hookspec = HookspecMarker ("example" )
14
16
hookimpl = HookimplMarker ("example" )
@@ -77,7 +79,7 @@ def __init__(self, num: int) -> None:
77
79
self .num = num
78
80
79
81
def __repr__ (self ) -> str :
80
- return f"<Plugin { self .num } >"
82
+ return f"<Plugin { saferepr ( self .num ) } >"
81
83
82
84
@hookimpl
83
85
def fun (self , hooks , nesting : int ) -> None :
@@ -89,7 +91,7 @@ def __init__(self, num: int) -> None:
89
91
self .num = num
90
92
91
93
def __repr__ (self ) -> str :
92
- return f"<PluginWrap { self .num } >"
94
+ return f"<PluginWrap { saferepr ( self .num ) } >"
93
95
94
96
@hookimpl (wrapper = True )
95
97
def fun (self ):
You can’t perform that action at this time.
0 commit comments