gh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (#102115)

This commit is contained in:
chgnrdv 2023-04-15 08:53:31 +03:00 committed by GitHub
parent 8af8f52d17
commit 2b6f5c3483
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -1067,6 +1067,13 @@ class DisTests(DisTestBase):
check(dis_nested_2, depth=None)
check(dis_nested_2)
def test__try_compile_no_context_exc_on_error(self):
# see gh-102114
try:
dis._try_compile(")", "")
except Exception as e:
self.assertIsNone(e.__context__)
@staticmethod
def code_quicken(f, times=ADAPTIVE_WARMUP_DELAY):
for _ in range(times):