Skip to content

Commit 0a8e7fd

Browse files
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 d593881) Co-authored-by: jsnklln <jsnklln@gmail.com>
1 parent d360346 commit 0a8e7fd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/pdb.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
# commands and is appended to __doc__ after the class has been defined.
6969

7070
import os
71+
import io
7172
import re
7273
import sys
7374
import cmd
@@ -1565,7 +1566,7 @@ def _runscript(self, filename):
15651566
self._wait_for_mainpyfile = True
15661567
self.mainpyfile = self.canonic(filename)
15671568
self._user_requested_quit = False
1568-
with open(filename, "rb") as fp:
1569+
with io.open_code(filename) as fp:
15691570
statement = "exec(compile(%r, %r, 'exec'))" % \
15701571
(fp.read(), self.mainpyfile)
15711572
self.run(statement)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:mod:`pdb` now uses :meth:`io.open_code` to trigger auditing events.

0 commit comments

Comments
 (0)