mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
gh-113744: Add a new IncompleteInputError exception to improve incomplete input detection in the codeop module (#113745)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
parent
1f515e8a10
commit
39d102c2ee
11 changed files with 21 additions and 4 deletions
|
@ -65,9 +65,10 @@ def _maybe_compile(compiler, source, filename, symbol):
|
|||
try:
|
||||
compiler(source + "\n", filename, symbol)
|
||||
return None
|
||||
except IncompleteInputError as e:
|
||||
return None
|
||||
except SyntaxError as e:
|
||||
if "incomplete input" in str(e):
|
||||
return None
|
||||
pass
|
||||
# fallthrough
|
||||
|
||||
return compiler(source, filename, symbol, incomplete_input=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue