[Python-checkins] r79769 - in python/trunk: Lib/dis.py Misc/NEWS

benjamin.peterson python-checkins at python.org
Mon Apr 5 01:23:22 CEST 2010


Author: benjamin.peterson
Date: Mon Apr  5 01:23:22 2010
New Revision: 79769

Log:
fix dis on new style classes #8310

Modified:
   python/trunk/Lib/dis.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/dis.py
==============================================================================
--- python/trunk/Lib/dis.py	(original)
+++ python/trunk/Lib/dis.py	Mon Apr  5 01:23:22 2010
@@ -10,6 +10,9 @@
            "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 @@
         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)

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Apr  5 01:23:22 2010
@@ -49,6 +49,8 @@
 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:
 


More information about the Python-checkins mailing list