Better fix for include/comments, squelch internal compiler exceptions if previous...
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 16 Aug 2008 22:36:23 +0000 (15:36 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 16 Aug 2008 22:36:23 +0000 (15:36 -0700)
Cython/Compiler/Main.py
Cython/Compiler/Parsing.py
Cython/Compiler/Scanning.py

index 9f9c4dfd352b612c9a08c120609a02d740c3a4d2..8a9139d0296d4cecbf13d645c890ff9755ccb94f 100644 (file)
@@ -19,7 +19,7 @@ import Errors
 import Parsing
 import Version
 from Scanning import PyrexScanner, FileSourceDescriptor
-from Errors import PyrexError, CompileError, error
+from Errors import PyrexError, CompileError, InternalError, error
 from Symtab import BuiltinScope, ModuleScope
 from Cython import Utils
 from Cython.Utils import open_new_file, replace_suffix
@@ -170,6 +170,10 @@ class Context:
         except CompileError, err:
             # err is set
             Errors.report_error(err)
+        except InternalError, err:
+            # Only raise if there was not an earlier error
+            if Errors.num_errors == 0:
+                raise
         return (err, data)
 
     def find_module(self, module_name, 
index 9f5e053967dd8e0d2462cd2f1cbf74a032a1c4e0..b39bb2d7950b857aa5975e1c2950d78ade00367c 100644 (file)
@@ -1271,8 +1271,7 @@ def p_include_statement(s, ctx):
             s.included_files.append(include_file_name)
             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
+            s2 = PyrexScanner(f, source_desc, s, source_encoding=f.encoding, parse_comments=s.parse_comments)
             try:
                 tree = p_statement_list(s2, ctx)
             finally:
index a2981504eed2a228463df88b95eb5378d27e7826..18147457e8fd3ac027990875569032874ae2a6b0 100644 (file)
@@ -290,7 +290,7 @@ class PyrexScanner(Scanner):
     resword_dict = build_resword_dict()
 
     def __init__(self, file, filename, parent_scanner = None, 
-                 scope = None, context = None, source_encoding=None):
+                 scope = None, context = None, source_encoding=None, parse_comments=True):
         Scanner.__init__(self, get_lexicon(), file, filename)
         if parent_scanner:
             self.context = parent_scanner.context
@@ -306,7 +306,7 @@ class PyrexScanner(Scanner):
             self.compile_time_env = initial_compile_time_env()
             self.compile_time_eval = 1
             self.compile_time_expr = 0
-        self.parse_comments = True
+        self.parse_comments = parse_comments
         self.source_encoding = source_encoding
         self.trace = trace_scanner
         self.indentation_stack = [0]