]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38723: Pdb._runscript should use io.open_code() instead of open() (GH-17127)
authorjsnklln <jsnklln@gmail.com>
Tue, 12 Nov 2019 22:42:47 +0000 (17:42 -0500)
committerSteve Dower <steve.dower@python.org>
Tue, 12 Nov 2019 22:42:47 +0000 (14:42 -0800)
Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
Lib/pdb.py
Misc/NEWS.d/next/Library/2019-11-12-15-46-28.bpo-38723.gcdMFn.rst [new file with mode: 0644]

index 8639204891cb01e11134bc7f9171ab079b3f6e0d..bf503f1e73ee1412908954dd5cdaf1f3e57168f7 100755 (executable)
@@ -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)
diff --git a/Misc/NEWS.d/next/Library/2019-11-12-15-46-28.bpo-38723.gcdMFn.rst b/Misc/NEWS.d/next/Library/2019-11-12-15-46-28.bpo-38723.gcdMFn.rst
new file mode 100644 (file)
index 0000000..c84bb85
--- /dev/null
@@ -0,0 +1 @@
+:mod:`pdb` now uses :meth:`io.open_code` to trigger auditing events.