@@ -182,18 +182,17 @@ def parse_hookimpl_opts(self, plugin: _Plugin, name: str) -> HookimplOpts | None
182
182
options for items decorated with :class:`HookimplMarker`.
183
183
"""
184
184
185
- # IMPORTANT: accessing an @property can have side effects that we dont want to trigger
186
- # if attr is a property, skip it in advance (@property methods can never be hookimpls)
185
+ # IMPORTANT: @property methods can have side effects, and are never hookimpl
186
+ # if attr is a property, skip it in advance
187
187
plugin_class = plugin if inspect .isclass (plugin ) else type (plugin )
188
188
if isinstance (getattr (plugin_class , name , None ), property ):
189
189
return None
190
190
191
- # if attr is field on a pydantic model, skip it (pydantic fields are never hookimpls)
192
- if hasattr (plugin , "__pydantic_core_schema__" ) and name in getattr (
193
- plugin , "model_fields" , {}
194
- ):
195
- # pydantic can present class attributes, instance attributes, or methods
196
- # but none of them can be hookimpls so they throw off the logic below
191
+ # pydantic model fields are like attrs and also can never be hookimpls
192
+ plugin_is_pydantic_obj = hasattr (plugin , "__pydantic_core_schema__" )
193
+ if plugin_is_pydantic_obj and name in getattr (plugin , "model_fields" , {}):
194
+ # pydantic models mess with the class and attr __signature__
195
+ # so inspect.isroutine(...) throws exceptions and cant be used
197
196
return None
198
197
199
198
method : object = getattr (plugin , name )
0 commit comments