Commit eb1a531e authored by Robert Bradshaw's avatar Robert Bradshaw

Require cython: for compiler directives

parent 2a785d75
......@@ -13,7 +13,7 @@ class CythonScope(ModuleScope):
self.shape_entry = self.declare_cfunction('shape',
shape_func_type,
pos=None,
visibility='extern',
defining = 1,
cname='<error>')
def create_cython_scope(context):
......
......@@ -1272,6 +1272,7 @@ def p_include_statement(s, ctx):
f = Utils.open_source_file(include_file_path, mode="rU")
source_desc = FileSourceDescriptor(include_file_path)
s2 = PyrexScanner(f, source_desc, s, source_encoding=f.encoding)
s2.parse_comments = s.parse_comments
try:
tree = p_statement_list(s2, ctx)
finally:
......@@ -2346,7 +2347,7 @@ def p_code(s, level=None):
repr(s.sy), repr(s.systring)))
return body
COMPILER_DIRECTIVE_COMMENT_RE = re.compile(r"^#\s*([a-z]+)\s*=(.*)$")
COMPILER_DIRECTIVE_COMMENT_RE = re.compile(r"^#\s*cython:\s*([a-z]+)\s*=(.*)$")
def p_compiler_directive_comments(s):
result = {}
......
# boundscheck = False
# ignoreme = OK
# cython: boundscheck = False
# cython: ignoreme = OK
# This testcase is most useful if you inspect the generated C file
......@@ -17,7 +17,7 @@ def f(object[int, ndim=2] buf):
@cy.boundscheck(True)
def g(object[int, ndim=2] buf):
# The below line should have no meaning
# boundscheck = False
# cython: boundscheck = False
# even if the above line doesn't follow indentation.
print buf[3, 2] # bc
......
# nonexistant = True
# boundscheck = true
# boundscheck = 9
# cython: nonexistant = True
# cython: boundscheck = true
# cython: boundscheck = 9
print 3
# Options should not be interpreted any longer:
# boundscheck = true
# cython: boundscheck = true
_ERRORS = u"""
3:0: boundscheck directive must be set to True or False
......
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