Skip to content

Commit

Permalink
bpo-38723: Pdb._runscript should use io.open_code() instead of open() (
Browse files Browse the repository at this point in the history
…pythonGH-17127)

Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
  • Loading branch information
2 people authored and shihai1991 committed Jan 31, 2020
1 parent e0d3d99 commit 7d905a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
# commands and is appended to __doc__ after the class has been defined.

import os
import io
import re
import sys
import cmd
Expand Down Expand Up @@ -1565,7 +1566,7 @@ def _runscript(self, filename):
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:mod:`pdb` now uses :meth:`io.open_code` to trigger auditing events.

0 comments on commit 7d905a8

Please sign in to comment.