diff --git a/Lib/pdb.py b/Lib/pdb.py index d379d1a9abd..e272f2ebb32 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -1210,8 +1210,9 @@ def _runscript(self, filename): self._wait_for_mainpyfile = 1 self.mainpyfile = self.canonic(filename) self._user_requested_quit = 0 - with open(filename) as fp: - statement = "exec(%r)" % (fp.read(),) + with open(filename, "rb") as fp: + statement = "exec(compile(%r, %r, 'exec'))" % \ + (fp.read(), self.mainpyfile) self.run(statement) # Simplified interface diff --git a/Misc/NEWS b/Misc/NEWS index f412f725e5b..8c9bb93bbf5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -42,6 +42,8 @@ C-API Library ------- +- Issue #6126: Fixed pdb command-line usage. + - Issue #6629: Fix a data corruption issue in the new I/O library, which could occur when writing to a BufferedRandom object (e.g. a file opened in "rb+" or "wb+" mode) after having buffered a certain amount of data for reading. This