Mercurial > cpython-lru_cache-weakref
comparison Tools/scripts/findnocoding.py @ 78376:8ace059cdffd
Cleanup findnocoding.py and pysource.py scripts (with infile/infile.close)
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Thu, 02 Aug 2012 00:05:41 +0200 |
| parents | 67d36e8ddcfc |
| children | 2dfe8262093c |
comparison
equal
deleted
inserted
replaced
| 78375:67d36e8ddcfc | 78376:8ace059cdffd |
|---|---|
| 58 line1 = infile.readline() | 58 line1 = infile.readline() |
| 59 line2 = infile.readline() | 59 line2 = infile.readline() |
| 60 | 60 |
| 61 if get_declaration(line1) or get_declaration(line2): | 61 if get_declaration(line1) or get_declaration(line2): |
| 62 # the file does have an encoding declaration, so trust it | 62 # the file does have an encoding declaration, so trust it |
| 63 infile.close() | |
| 64 return False | 63 return False |
| 65 | 64 |
| 66 # check the whole file for non utf-8 characters | 65 # check the whole file for non utf-8 characters |
| 67 rest = infile.read() | 66 rest = infile.read() |
| 68 | 67 |
