From: Benjamin Peterson Date: Sun, 4 Apr 2010 23:23:22 +0000 (+0000) Subject: fix dis on new style classes #8310 X-Git-Tag: v2.7b1~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76a23c17bcd9e3f47cbddaf6a2032bd1d27e0419;p=thirdparty%2FPython%2Fcpython.git fix dis on new style classes #8310 --- diff --git a/Lib/dis.py b/Lib/dis.py index edc210fbcf11..5aa09c95b6d8 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -10,6 +10,9 @@ __all__ = ["dis", "disassemble", "distb", "disco", "findlinestarts", "findlabels"] + _opcodes_all del _opcodes_all +_have_code = (types.MethodType, types.FunctionType, types.CodeType, + types.ClassType, type) + def dis(x=None): """Disassemble classes, methods, functions, or code. @@ -29,10 +32,7 @@ def dis(x=None): items = x.__dict__.items() items.sort() for name, x1 in items: - if isinstance(x1, (types.MethodType, - types.FunctionType, - types.CodeType, - types.ClassType)): + if isinstance(x1, _have_code): print "Disassembly of %s:" % name try: dis(x1) diff --git a/Misc/NEWS b/Misc/NEWS index 4cb76adc01b1..0ee0c07e4afb 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -49,6 +49,8 @@ Core and Builtins Library ------- +- Issue #8310: Allow dis to examine new style classes. + - Issue #8257: The Decimal construct now accepts a float instance directly, converting that float to a Decimal of equal value: