summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorjsnklln <jsnklln@gmail.com>2019-11-12 22:42:47 (GMT)
committerSteve Dower <steve.dower@python.org>2019-11-12 22:42:47 (GMT)
commitd593881505c1f4acfd17f41312b27cc898451816 (patch)
treee988263167a3ef938130e7a8825d6c8315890ca0 /Lib
parent138ccbb02216ca086047c3139857fb44f3dab1f9 (diff)
downloadcpython-d593881505c1f4acfd17f41312b27cc898451816.zip
cpython-d593881505c1f4acfd17f41312b27cc898451816.tar.gz
cpython-d593881505c1f4acfd17f41312b27cc898451816.tar.bz2
bpo-38723: Pdb._runscript should use io.open_code() instead of open() (GH-17127)
Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/pdb.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 8639204..bf503f1 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -68,6 +68,7 @@ Debugger commands
# commands and is appended to __doc__ after the class has been defined.
import os
+import io
import re
import sys
import cmd
@@ -1565,7 +1566,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
self._wait_for_mainpyfile = True
self.mainpyfile = self.canonic(filename)
self._user_requested_quit = False
- with open(filename, "rb") as fp:
+ with io.open_code(filename) as fp:
statement = "exec(compile(%r, %r, 'exec'))" % \
(fp.read(), self.mainpyfile)
self.run(statement)