diff options
author | Greg Ward <gward@python.net> | 1999-04-15 17:50:19 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 1999-04-15 17:50:19 (GMT) |
commit | 4e5a7c70563eb123e68a29337ef00808f828f1fd (patch) | |
tree | 2463e36af76fbb2edef2cf637282ecd7acbf20d1 /Lib/distutils | |
parent | 0ebd5483bec56aa396107d201c63beaabcb313e1 (diff) | |
download | cpython-4e5a7c70563eb123e68a29337ef00808f828f1fd.zip cpython-4e5a7c70563eb123e68a29337ef00808f828f1fd.tar.gz cpython-4e5a7c70563eb123e68a29337ef00808f828f1fd.tar.bz2 |
'warn()' method now takes an optional line number.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/text_file.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/distutils/text_file.py b/Lib/distutils/text_file.py index bc56a49..a27df06 100644 --- a/Lib/distutils/text_file.py +++ b/Lib/distutils/text_file.py @@ -72,12 +72,14 @@ class TextFile: self.current_line = None - def warn (self, msg): + def warn (self, msg, line=None): + if line is None: + line = self.current_line sys.stderr.write (self.filename + ", ") - if type (self.current_line) is ListType: - sys.stderr.write ("lines %d-%d: " % tuple (self.current_line)) + if type (line) is ListType: + sys.stderr.write ("lines %d-%d: " % tuple (line)) else: - sys.stderr.write ("line %d: " % self.current_line) + sys.stderr.write ("line %d: " % line) sys.stderr.write (msg + "\n") |