diff options
-rw-r--r-- | Lib/dis.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -10,6 +10,8 @@ __all__ = ["dis", "disassemble", "distb", "disco", "findlinestarts", "findlabels"] + _opcodes_all del _opcodes_all +_have_code = (types.MethodType, types.FunctionType, types.CodeType, type) + def dis(x=None): """Disassemble classes, methods, functions, or code. @@ -26,8 +28,7 @@ def dis(x=None): if hasattr(x, '__dict__'): items = sorted(x.__dict__.items()) for name, x1 in items: - if isinstance(x1, (types.MethodType, types.FunctionType, - types.CodeType, type)): + if isinstance(x1, _have_code): print("Disassembly of %s:" % name) try: dis(x1) |