mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
As per python-dev discussion with Eli, properly document and publish dis.show_code
This commit is contained in:
parent
c02adca999
commit
e8814fbb32
2 changed files with 13 additions and 7 deletions
|
@ -7,7 +7,7 @@ from opcode import *
|
|||
from opcode import __all__ as _opcodes_all
|
||||
|
||||
__all__ = ["code_info", "dis", "disassemble", "distb", "disco",
|
||||
"findlinestarts", "findlabels"] + _opcodes_all
|
||||
"findlinestarts", "findlabels", "show_code"] + _opcodes_all
|
||||
del _opcodes_all
|
||||
|
||||
_have_code = (types.MethodType, types.FunctionType, types.CodeType, type)
|
||||
|
@ -140,12 +140,8 @@ def _format_code_info(co):
|
|||
lines.append("%4d: %s" % i_n)
|
||||
return "\n".join(lines)
|
||||
|
||||
# show_code is deliberately undocumented and left out of __all__,
|
||||
# since it doesn't offer any real benefit over code_info() above
|
||||
# It is only retained because it already existed and was not
|
||||
# marked as private in previous versions of Python
|
||||
def show_code(co):
|
||||
"""Show details about a code object."""
|
||||
"""Print details of methods, functions, or code to stdout."""
|
||||
print(code_info(co))
|
||||
|
||||
def disassemble(co, lasti=-1):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue