Skip to content

Commit

Permalink
Do not support classes with __call__
Browse files Browse the repository at this point in the history
  • Loading branch information
devennavani committed May 7, 2024
1 parent 5d6dbfb commit 78299ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modal/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,9 @@ def wrapped(
) -> _Function:
nonlocal keep_warm, is_generator

# Check if the decorated object is a class and does not have a __call__ method
if inspect.isclass(f) and not hasattr(f, "__call__"):
raise TypeError("The @app.function decorator cannot be used on a class without a __call__ method.")
# Check if the decorated object is a class
if inspect.isclass(f):
raise TypeError("The @app.function decorator cannot be used on a class.")

if isinstance(f, _PartialFunction):
f.wrapped = True
Expand Down

0 comments on commit 78299ae

Please sign in to comment.