Commit 7f89a1d6 authored by Stefan Behnel's avatar Stefan Behnel

allow unprefixed 'str' literals in C varargs lists

parent 0e1e8803
...@@ -120,6 +120,8 @@ Bugs fixed ...@@ -120,6 +120,8 @@ Bugs fixed
* Some complex Python expressions could fail to compile inside of finally * Some complex Python expressions could fail to compile inside of finally
clauses. clauses.
* Unprefixed 'str' literals were not supported as C varargs arguments.
Other changes Other changes
------------- -------------
......
...@@ -4799,6 +4799,9 @@ class SimpleCallNode(CallNode): ...@@ -4799,6 +4799,9 @@ class SimpleCallNode(CallNode):
for i in range(max_nargs, actual_nargs): for i in range(max_nargs, actual_nargs):
arg = args[i] arg = args[i]
if arg.type.is_pyobject: if arg.type.is_pyobject:
if arg.type is str_type:
arg_ctype = PyrexTypes.c_char_ptr_type
else:
arg_ctype = arg.type.default_coerced_ctype() arg_ctype = arg.type.default_coerced_ctype()
if arg_ctype is None: if arg_ctype is None:
error(self.args[i].pos, error(self.args[i].pos,
......
cdef grail(char *blarg, ...): cdef grail(const char *blarg, ...):
pass pass
def swallow(): def swallow():
""" """
>>> swallow() >>> swallow()
""" """
grail("spam") grail("spam")
grail("spam", 42) grail("spam", 42)
grail("spam", b"abc")
grail("spam", "abc")
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