diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-04-26 05:28:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 05:28:29 (GMT) |
commit | f11ba1c2decd2fa6e9dfe93b9df4b80b46a290be (patch) | |
tree | 81568fb32553bcb6cabef8f9940bb7f751bb8882 /Lib/test/test_pdb.py | |
parent | d9aafe249994bc142927a9d92242613ae9d42d13 (diff) | |
download | cpython-f11ba1c2decd2fa6e9dfe93b9df4b80b46a290be.zip cpython-f11ba1c2decd2fa6e9dfe93b9df4b80b46a290be.tar.gz cpython-f11ba1c2decd2fa6e9dfe93b9df4b80b46a290be.tar.bz2 |
[3.11] gh-103578: Fix pdb reading code with non-utf8 encoding (GH-103581) (#103867)
`pdb` should use `io.open_code` to open code to avoid encoding issue.
(cherry picked from commit 31acfd78a0810f84898d36a8289e407d3754b823)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r-- | Lib/test/test_pdb.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 1a0fbf4..9328cca 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -2348,6 +2348,12 @@ def bœr(): # verify that pdb found the source of the "frozen" function self.assertIn('x = "Sentinel string for gh-93696"', stdout, "Sentinel statement not found") + def test_non_utf8_encoding(self): + script_dir = os.path.join(os.path.dirname(__file__), 'encoded_modules') + for filename in os.listdir(script_dir): + if filename.endswith(".py"): + self._run_pdb([os.path.join(script_dir, filename)], 'q') + class ChecklineTests(unittest.TestCase): def setUp(self): linecache.clearcache() # Pdb.checkline() uses linecache.getline() |