mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
bpo-43202: Immediately return code object in codeop._maybe_compile (GH-24508)
The return used to be after code that was ignored when there was a code object.
This commit is contained in:
parent
fedd86df24
commit
2068b261e9
1 changed files with 2 additions and 4 deletions
|
@ -77,10 +77,10 @@ def _maybe_compile(compiler, source, filename, symbol):
|
|||
source = "pass" # Replace it with a 'pass' statement
|
||||
|
||||
err = err1 = err2 = None
|
||||
code = code1 = code2 = None
|
||||
code1 = code2 = None
|
||||
|
||||
try:
|
||||
code = compiler(source, filename, symbol)
|
||||
return compiler(source, filename, symbol)
|
||||
except SyntaxError:
|
||||
pass
|
||||
|
||||
|
@ -100,8 +100,6 @@ def _maybe_compile(compiler, source, filename, symbol):
|
|||
err2 = e
|
||||
|
||||
try:
|
||||
if code:
|
||||
return code
|
||||
if not code1 and _is_syntax_error(err1, err2):
|
||||
raise err1
|
||||
finally:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue