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 d593881505)

Co-authored-by: jsnklln <jsnklln@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-11-12 15:09:03 -08:00 committed by GitHub
parent d360346640
commit 0a8e7fde06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -0,0 +1 @@
:mod:`pdb` now uses :meth:`io.open_code` to trigger auditing events.