From c5b12aac1fa2de24b49f1f7022744ce8b26166e5 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 2 Feb 2010 04:18:23 -0800 Subject: [PATCH] New message(...) distinct from warn(...) --- Cython/Compiler/Errors.py | 11 +++++++++++ Cython/Compiler/TypeInference.py | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/Errors.py b/Cython/Compiler/Errors.py index 4b9a5792..c04390da 100644 --- a/Cython/Compiler/Errors.py +++ b/Cython/Compiler/Errors.py @@ -139,6 +139,17 @@ def error(position, message): LEVEL=1 # warn about all errors level 1 or higher +def message(position, message, level=1): + if level < LEVEL: + return + warn = CompileWarning(position, message) + line = "note: %s\n" % warn + if listing_file: + listing_file.write(line) + if echo_file: + echo_file.write(line) + return warn + def warning(position, message, level=0): if level < LEVEL: return diff --git a/Cython/Compiler/TypeInference.py b/Cython/Compiler/TypeInference.py index 4cd4fe6a..d7089d57 100644 --- a/Cython/Compiler/TypeInference.py +++ b/Cython/Compiler/TypeInference.py @@ -1,4 +1,4 @@ -from Errors import error, warning, warn_once, InternalError +from Errors import error, warning, message, warn_once, InternalError import ExprNodes import Nodes import Builtin @@ -181,7 +181,7 @@ class SimpleAssignmentTypeInferer: # print "No assignments", entry.pos, entry entry.type = py_object_type if verbose: - warning(entry.pos, "inferred '%s' to be of type '%s'" % (entry.name, entry.type), 1) + message(entry.pos, "inferred '%s' to be of type '%s'" % (entry.name, entry.type)) resolve_dependancy(entry) # Deal with simple circular dependancies... for entry, deps in dependancies_by_entry.items(): @@ -202,7 +202,7 @@ class SimpleAssignmentTypeInferer: for entry in dependancies_by_entry: entry.type = py_object_type if verbose: - warning(entry.pos, "inferred '%s' to be of type '%s' (default)" % (entry.name, entry.type), 1) + message(entry.pos, "inferred '%s' to be of type '%s' (default)" % (entry.name, entry.type)) def find_spanning_type(type1, type2): if type1 is type2: -- 2.26.2