Skip to content

Commit 57a83db

Browse files
committed
try IncrementalNewlineDecoder in doctest
1 parent 3ad8fd7 commit 57a83db

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Lib/doctest.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _test():
102102
import sys
103103
import traceback
104104
import unittest
105-
from io import StringIO # XXX: RUSTPYTHON; , IncrementalNewlineDecoder
105+
from io import StringIO, IncrementalNewlineDecoder
106106
from collections import namedtuple
107107

108108
TestResults = namedtuple('TestResults', 'failed attempted')
@@ -230,9 +230,7 @@ def _load_testfile(filename, package, module_relative, encoding):
230230
# get_data() opens files as 'rb', so one must do the equivalent
231231
# conversion as universal newlines would do.
232232

233-
# TODO: RUSTPYTHON; use _newline_convert once io.IncrementalNewlineDecoder is implemented
234-
return file_contents.replace(os.linesep, '\n'), filename
235-
# return _newline_convert(file_contents), filename
233+
return _newline_convert(file_contents), filename
236234
with open(filename, encoding=encoding) as f:
237235
return f.read(), filename
238236

0 commit comments

Comments
 (0)