Commit 2edd9423 authored by Stefan Behnel's avatar Stefan Behnel

merge branch 0.19.x

parents 5ac22149 db7d6bd2
......@@ -889,8 +889,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
'The %s directive takes one compile-time integer argument' % optname)
return (optname, int(args[0].value))
elif directivetype is str:
if kwds is not None or len(args) != 1 or not isinstance(args[0], (ExprNodes.StringNode,
ExprNodes.UnicodeNode)):
if kwds is not None or len(args) != 1 or not isinstance(
args[0], (ExprNodes.StringNode, ExprNodes.UnicodeNode)):
raise PostParseError(pos,
'The %s directive takes one compile-time string argument' % optname)
return (optname, str(args[0].value))
......@@ -909,6 +909,12 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
raise PostParseError(pos,
'The %s directive takes no keyword arguments' % optname)
return optname, [ str(arg.value) for arg in args ]
elif callable(directivetype):
if kwds is not None or len(args) != 1 or not isinstance(
args[0], (ExprNodes.StringNode, ExprNodes.UnicodeNode)):
raise PostParseError(pos,
'The %s directive takes one compile-time string argument' % optname)
return (optname, directivetype(optname, args[0].value))
else:
assert False
......
# mode: error
cimport cython
cdef class TestClass:
def foo(self):
with cython.c_string_encoding("ascii"):
return
### FIXME: way to many errors for my taste...
_ERRORS = """
7:13: The c_string_encoding compiler directive is not allowed in with statement scope
7:19: 'c_string_encoding' not a valid cython language construct
7:19: 'c_string_encoding' not a valid cython attribute or is being used incorrectly
"""
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