summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-11-12 23:09:03 (GMT)
committerGitHub <noreply@github.com>2019-11-12 23:09:03 (GMT)
commit0a8e7fde064c8fb6eb8e78752d4bcdab56643065 (patch)
tree799252207f1a5014d1f23d858a0fe654a4b77eef /Lib
parentd360346640e19231032b072216195484fa2450b4 (diff)
downloadcpython-0a8e7fde064c8fb6eb8e78752d4bcdab56643065.zip
cpython-0a8e7fde064c8fb6eb8e78752d4bcdab56643065.tar.gz
cpython-0a8e7fde064c8fb6eb8e78752d4bcdab56643065.tar.bz2
bpo-38723: Pdb._runscript should use io.open_code() instead of open() (GH-17127)
Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com> (cherry picked from commit d593881505c1f4acfd17f41312b27cc898451816) Co-authored-by: jsnklln <jsnklln@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)