Skip to content

Commit

Permalink
Explicitly check hook signature (#7502)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Nov 18, 2024
1 parent b597638 commit 951f620
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions panel/viewable.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import asyncio
import functools
import inspect
import logging
import os
import sys
Expand Down Expand Up @@ -600,9 +601,9 @@ def _preprocess(self, root: 'Model', changed=None, old_models=None) -> None:
changed = self if changed is None else changed
hooks = self._preprocessing_hooks+self._hooks
for hook in hooks:
try:
if len(inspect.signature(hook).parameters) >= 4:
hook(self, root, changed, old_models)
except TypeError:
else:
hook(self, root)

def _render_model(self, doc: Optional[Document] = None, comm: Optional[Comm] = None) -> 'Model':
Expand Down

0 comments on commit 951f620

Please sign in to comment.