mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Added 'warn' method.
This commit is contained in:
parent
7eca8e5017
commit
f6cdcd509d
1 changed files with 10 additions and 1 deletions
|
@ -9,7 +9,7 @@ lines, and joining lines with backslashes."""
|
|||
__revision__ = "$Id$"
|
||||
|
||||
from types import *
|
||||
import os, string, re
|
||||
import sys, os, string, re
|
||||
|
||||
|
||||
class TextFile:
|
||||
|
@ -67,6 +67,15 @@ class TextFile:
|
|||
self.current_line = None
|
||||
|
||||
|
||||
def warn (self, msg):
|
||||
sys.stderr.write (self.filename + ", ")
|
||||
if type (self.current_line) is ListType:
|
||||
sys.stderr.write ("lines %d-%d: " % tuple (self.current_line))
|
||||
else:
|
||||
sys.stderr.write ("line %d: " % self.current_line)
|
||||
sys.stderr.write (msg + "\n")
|
||||
|
||||
|
||||
def readline (self):
|
||||
|
||||
buildup_line = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue