diff options
Diffstat (limited to 'Lib/trace.py')
-rw-r--r-- | Lib/trace.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/trace.py b/Lib/trace.py index 8ea4b89..b50aa02 100644 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -432,10 +432,9 @@ def find_strings(filename, encoding=None): def find_executable_linenos(filename): """Return dict where keys are line numbers in the line number table.""" try: - with io.FileIO(filename, 'r') as file: - encoding, lines = tokenize.detect_encoding(file.readline) - with open(filename, "r", encoding=encoding) as f: + with tokenize.open(filename) as f: prog = f.read() + encoding = f.encoding except IOError as err: print(("Not printing coverage data for %r: %s" % (filename, err)), file=sys.stderr) |