@property
def code(self):
- with io.open(self) as fp:
+ with io.open_code(self) as fp:
return f"exec(compile({fp.read()!r}, {self!r}, 'exec'))"
# 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()