Skip to content

Commit

Permalink
fixup! [3.11] gh-111366: Correctly show custom syntax error messages …
Browse files Browse the repository at this point in the history
…in the codeop module functions (GH-111384). (cherry picked from commit cd6e0a0)
  • Loading branch information
pablogsal committed Oct 30, 2023
1 parent f10a62c commit 2895617
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lib/codeop.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ def _maybe_compile(compiler, source, filename, symbol):

return compiler(source, filename, symbol, incomplete_input=False)

def _is_syntax_error(err1, err2):
rep1 = repr(err1)
rep2 = repr(err2)
if "was never closed" in rep1 and "was never closed" in rep2:
return False
if rep1 == rep2:
return True
return False

def _compile(source, filename, symbol, incomplete_input=True):
flags = 0
if incomplete_input:
Expand Down

0 comments on commit 2895617

Please sign in to comment.