mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Fix test_linecache change.
In non-UTF8 locales open() will have the wrong encoding for the test data. We need to open the file via tokenize, to get a detected encoding instead.
This commit is contained in:
parent
dc77565990
commit
e4d35dc8b6
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@ import linecache
|
|||
import unittest
|
||||
import os.path
|
||||
import tempfile
|
||||
import tokenize
|
||||
from test import support
|
||||
|
||||
|
||||
|
@ -54,7 +55,7 @@ class GetLineTestsGoodData(TempFile):
|
|||
super().setUp()
|
||||
|
||||
def test_getline(self):
|
||||
with open(self.file_name) as fp:
|
||||
with tokenize.open(self.file_name) as fp:
|
||||
for index, line in enumerate(fp):
|
||||
if not line.endswith('\n'):
|
||||
line += '\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue