]> granicus.if.org Git - python/commitdiff
Merged revisions 79769 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Sun, 4 Apr 2010 23:27:35 +0000 (23:27 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 4 Apr 2010 23:27:35 +0000 (23:27 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79769 | benjamin.peterson | 2010-04-04 18:23:22 -0500 (Sun, 04 Apr 2010) | 1 line

  fix dis on new style classes #8310
........

Lib/dis.py
Misc/NEWS

index 5a74b3ae894b7fb378973a772193c33ca298f1d2..35ae595621a83d5e43354fcb82192982d2ee7984 100644 (file)
@@ -9,6 +9,9 @@ from opcode import __all__ as _opcodes_all
 __all__ = ["dis","disassemble","distb","disco"] + _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.
 
@@ -28,10 +31,7 @@ def dis(x=None):
         items = x.__dict__.items()
         items.sort()
         for name, x1 in items:
-            if type(x1) in (types.MethodType,
-                            types.FunctionType,
-                            types.CodeType,
-                            types.ClassType):
+            if isinstance(x1, _have_code):
                 print "Disassembly of %s:" % name
                 try:
                     dis(x1)
index be40f9f9fdd6b4df1069203d13bffb831b47a211..92bef1cb2891ffad791d9991962cd6aab9460cce 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,8 @@ Library
 
 - Issue #8179: Fix macpath.realpath() on a non-existing path.
 
+- Issue #8310: Allow dis to examine new style classes.
+
 - Issue #7667: Fix doctest failures with non-ASCII paths.
 
 - Issue #7624: Fix isinstance(foo(), collections.Callable) for old-style