Skip to content

Commit 2895617

Browse files
committed
fixup! [3.11] gh-111366: Correctly show custom syntax error messages in the codeop module functions (GH-111384). (cherry picked from commit cd6e0a0)
1 parent f10a62c commit 2895617

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/codeop.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ def _maybe_compile(compiler, source, filename, symbol):
7272

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

75+
def _is_syntax_error(err1, err2):
76+
rep1 = repr(err1)
77+
rep2 = repr(err2)
78+
if "was never closed" in rep1 and "was never closed" in rep2:
79+
return False
80+
if rep1 == rep2:
81+
return True
82+
return False
83+
7584
def _compile(source, filename, symbol, incomplete_input=True):
7685
flags = 0
7786
if incomplete_input:

0 commit comments

Comments
 (0)