| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -154,7 +154,7 @@ def namespace(self): | |||
| 154 | 154 | ||
| 155 | 155 | @property | |
| 156 | 156 | def code(self): | |
| 157 | - with io.open(self) as fp: | ||
| 157 | + with io.open_code(self) as fp: | ||
| 158 | 158 | return f"exec(compile({fp.read()!r}, {self!r}, 'exec'))" | |
| 159 | 159 | ||
| 160 | 160 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2396,6 +2396,12 @@ def _create_fake_frozen_module(): | |||
| 2396 | 2396 | # verify that pdb found the source of the "frozen" function | |
| 2397 | 2397 | self.assertIn('x = "Sentinel string for gh-93696"', stdout, "Sentinel statement not found") | |
| 2398 | 2398 | ||
| 2399 | + def test_non_utf8_encoding(self): | ||
| 2400 | + script_dir = os.path.join(os.path.dirname(__file__), 'encoded_modules') | ||
| 2401 | + for filename in os.listdir(script_dir): | ||
| 2402 | + if filename.endswith(".py"): | ||
| 2403 | + self._run_pdb([os.path.join(script_dir, filename)], 'q') | ||
| 2404 | + | ||
| 2399 | 2405 | class ChecklineTests(unittest.TestCase): | |
| 2400 | 2406 | def setUp(self): | |
| 2401 | 2407 | linecache.clearcache() # Pdb.checkline() uses linecache.getline() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Fixed a bug where :mod:`pdb` crashes when reading source file with different encoding by replacing :func:`io.open` with :func:`io.open_code`. The new method would also call into the hook set by :func:`PyFile_SetOpenCodeHook`. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments