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): ...@@ -163,7 +163,7 @@ def cmod(a, b):
def cast(type, *args, **kwargs): def cast(type, *args, **kwargs):
kwargs.pop('typecheck', None) kwargs.pop('typecheck', None)
assert not kwargs assert not kwargs
if hasattr(type, '__call__'): if callable(type) and not (args and isinstance(args[0], type)):
return type(*args) return type(*args)
else: else:
return args[0] 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