Commit 76a23c17 authored by Benjamin Peterson's avatar Benjamin Peterson

fix dis on new style classes #8310

parent 6f65d2dd
...@@ -10,6 +10,9 @@ __all__ = ["dis", "disassemble", "distb", "disco", ...@@ -10,6 +10,9 @@ __all__ = ["dis", "disassemble", "distb", "disco",
"findlinestarts", "findlabels"] + _opcodes_all "findlinestarts", "findlabels"] + _opcodes_all
del _opcodes_all del _opcodes_all
_have_code = (types.MethodType, types.FunctionType, types.CodeType,
types.ClassType, type)
def dis(x=None): def dis(x=None):
"""Disassemble classes, methods, functions, or code. """Disassemble classes, methods, functions, or code.
...@@ -29,10 +32,7 @@ def dis(x=None): ...@@ -29,10 +32,7 @@ def dis(x=None):
items = x.__dict__.items() items = x.__dict__.items()
items.sort() items.sort()
for name, x1 in items: for name, x1 in items:
if isinstance(x1, (types.MethodType, if isinstance(x1, _have_code):
types.FunctionType,
types.CodeType,
types.ClassType)):
print "Disassembly of %s:" % name print "Disassembly of %s:" % name
try: try:
dis(x1) dis(x1)
......
...@@ -49,6 +49,8 @@ Core and Builtins ...@@ -49,6 +49,8 @@ Core and Builtins
Library Library
------- -------
- Issue #8310: Allow dis to examine new style classes.
- Issue #8257: The Decimal construct now accepts a float instance - Issue #8257: The Decimal construct now accepts a float instance
directly, converting that float to a Decimal of equal value: directly, converting that float to a Decimal of equal value:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment