New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stray RESUME opcode for unused lambda #90472
Comments
This code seems to get a RESUME opcode where no function call is happening: a = 1
fn = lambda 2
b = 3 Here is the disassembly. Offset 6 has a RESUME opcode for line 2: Python 3.11.0a3+ (heads/main:0fc58c1e05, Jan 8 2022, 19:45:58) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dis
>>> dis.dis("""\
... a = 1
... fn = lambda: 2
... b = 3
... """)
0 RESUME 0 1 2 LOAD_CONST 0 (1) 2 6 RESUME 0 3 14 LOAD_CONST 2 (3) Disassembly of <code object <lambda> at 0x10772c2d0, file "<dis>", line 2>: This causes an extra "call" event when tracing: ---< bug233.py >-------------------------------------------------------- import linecache, os.path, sys
def trace(frame, event, arg):
if (event != "line") and ("bug233" in frame.f_code.co_filename):
lineno = frame.f_lineno
first = frame.f_code.co_firstlineno
source = linecache.getline(frame.f_code.co_filename, lineno) if lineno else "******"
file = os.path.basename(frame.f_code.co_filename)
print("{} {}@{!s:4} (first={}): {}".format(event[:4], file, lineno, first, source.rstrip()))
return trace
print(sys.version)
sys.settrace(trace)
def f():
a = 1
fn = lambda: 2
b = 3
f() % python3.10 bug233.py % python3.11 bug233.py |
Thanks, Ned. |
Pablo, I've marked this as a release blocker so this bug doesn't get into 3.11a4. |
Unfortunately the release of 3.11.0a4 is already underway and we are waiting for Steve's windows binaries, so this will need to wait for alpha 5 |
Ok, I'll add a news item in that case. |
This fixes the problems I was seeing, thanks. |
Good; removing release blocker status. Keeping this open until Mark has added a NEWS item. |
The news item was added in PR 30515 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: