]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
'warn()' method now takes an optional line number.
authorGreg Ward <gward@python.net>
Thu, 15 Apr 1999 17:50:19 +0000 (17:50 +0000)
committerGreg Ward <gward@python.net>
Thu, 15 Apr 1999 17:50:19 +0000 (17:50 +0000)
Lib/distutils/text_file.py

index bc56a4906bc1160b0e63ef6cc263f01889740447..a27df06d45692dbb33cf55fbcfe3600c1e9dc81a 100644 (file)
@@ -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")