[issue39800] Inconsistent/incomplete disassembly of methods vs method source code
Steven D'Aprano
report at bugs.python.org
Sat Feb 29 23:24:00 EST 2020
Steven D'Aprano <steve+python at pearwood.info> added the comment:
Ah, I see now. I was using an older version of Python and the output of
dis was different. It didn't recurse in to show the disassembly of the
code object as well.
> The first block of instructions here are for the def statement, and
> the second block for the return statement.
The first block of byte code is for the def statement, and the second
block is for the code object, which may be more than just a return
statement.
What would you expect the disassembly of this to show?
dis.dis("""
import y
def f(x):
a = 2*x - 1
return a**2
print('hello')
""")
Would you expect the disassembled code object to show up in that as
well? I'm not sure what I would expect.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39800>
_______________________________________
More information about the Python-bugs-list
mailing list