Commit 3149eb83 authored by Stefan Behnel's avatar Stefan Behnel

Make it a bit less likely that the Python version of cython.cast() does something unexpected/wrong.

parent bf6cd7a0
......@@ -163,7 +163,7 @@ def cmod(a, b):
def cast(type, *args, **kwargs):
kwargs.pop('typecheck', None)
assert not kwargs
if hasattr(type, '__call__'):
if callable(type) and not (args and isinstance(args[0], type)):
return type(*args)
else:
return args[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment