summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 3b32004..bcc200e 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1323,7 +1323,8 @@ class DocTestRunner:
m = self.__LINECACHE_FILENAME_RE.match(filename)
if m and m.group('name') == self.test.name:
example = self.test.examples[int(m.group('examplenum'))]
- return example.source.splitlines(True)
+ source = example.source.encode('ascii', 'backslashreplace')
+ return source.splitlines(True)
else:
return self.save_linecache_getlines(filename, module_globals)