diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2021-02-12 00:31:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-12 00:31:10 (GMT) |
commit | 2068b261e95e9fe9c4041f0102c9e931692dd5aa (patch) | |
tree | d5464549b91b25a1afe56231508874aabd6a8b67 /Lib/codeop.py | |
parent | fedd86df2448370cdf62a229fd6f31dc92daf379 (diff) | |
download | cpython-2068b261e95e9fe9c4041f0102c9e931692dd5aa.zip cpython-2068b261e95e9fe9c4041f0102c9e931692dd5aa.tar.gz cpython-2068b261e95e9fe9c4041f0102c9e931692dd5aa.tar.bz2 |
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.
Diffstat (limited to 'Lib/codeop.py')
-rw-r--r-- | Lib/codeop.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/codeop.py b/Lib/codeop.py index 7a08610..b3af93f 100644 --- a/Lib/codeop.py +++ b/Lib/codeop.py @@ -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: |