Skip to content

Commit 984347e

Browse files
committed
Decorator: stricter arg-checking guard conditions.
1 parent ce739e5 commit 984347e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pywisetransfer/deprecation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ def _message(message=None, *args, **kwargs):
1717

1818
def __init__(self, *args, **kwargs):
1919
self.f = None
20-
if args and callable(args[0]):
20+
if len(args) == 1 and callable(args[0]):
2121
self.f, args = args[0], args[1:]
2222
self.message = self._message(*args, **kwargs)
2323

2424
def _emit_warning(self):
2525
warnings.warn(self.message, DeprecationWarning, stacklevel=3)
2626

2727
def __call__(self, *args, **kwargs):
28-
if args and callable(args[0]) and not isinstance(args[0], deprecated):
28+
if len(args) == 1 and callable(args[0]) and not isinstance(args[0], deprecated):
2929
global f
3030
f = orig = args[0]
3131
exec(

0 commit comments

Comments
 (0)