[Python-checkins] r79772 - in python/branches/release26-maint: Lib/dis.py Misc/NEWS

benjamin.peterson python-checkins at python.org
Mon Apr 5 01:27:35 CEST 2010


Author: benjamin.peterson
Date: Mon Apr  5 01:27:35 2010
New Revision: 79772

Log:
Merged revisions 79769 via svnmerge from 
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
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/dis.py
   python/branches/release26-maint/Misc/NEWS

Modified: python/branches/release26-maint/Lib/dis.py
==============================================================================
--- python/branches/release26-maint/Lib/dis.py	(original)
+++ python/branches/release26-maint/Lib/dis.py	Mon Apr  5 01:27:35 2010
@@ -9,6 +9,9 @@
 __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 @@
         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)

Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS	(original)
+++ python/branches/release26-maint/Misc/NEWS	Mon Apr  5 01:27:35 2010
@@ -27,6 +27,8 @@
 
 - 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


More information about the Python-checkins mailing list