Require cython: for compiler directives
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 16 Aug 2008 22:07:42 +0000 (15:07 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 16 Aug 2008 22:07:42 +0000 (15:07 -0700)
Cython/Compiler/CythonScope.py
Cython/Compiler/Parsing.py
tests/compile/c_directives.pyx
tests/errors/e_directives.pyx

index 289d5743d60906f230d83ac426522e6aa9106063..d14d7c8074f41835b0af0d123139c57163487520 100644 (file)
@@ -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):
index 7a8cc029cbad27100f1564b13c956ea1cda7c277..9f5e053967dd8e0d2462cd2f1cbf74a032a1c4e0 100644 (file)
@@ -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 = {}
index ccb22d08f0fd56acce74f98c2bc8c8df4879a4bb..f6158976e03ac7042ab359afa47dbd5c033a7f9a 100644 (file)
@@ -1,5 +1,5 @@
-#     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
 
index c626b4fdfe71bc06b1209f3f33bb242451bbf7a2..f63270fd6e21b610d8a39ab8bc3bfbf04df83978 100644 (file)
@@ -1,12 +1,12 @@
 
-# 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