[Python-3000-checkins] r62270 - in python/branches/py3k: Lib/trace.py Misc/NEWS

martin.v.loewis python-3000-checkins at python.org
Thu Apr 10 21:02:25 CEST 2008


Author: martin.v.loewis
Date: Thu Apr 10 21:02:25 2008
New Revision: 62270

Modified:
   python/branches/py3k/Lib/trace.py
   python/branches/py3k/Misc/NEWS
Log:
Bug #2606: Avoid calling .sort() on a dict_keys object.


Modified: python/branches/py3k/Lib/trace.py
==============================================================================
--- python/branches/py3k/Lib/trace.py	(original)
+++ python/branches/py3k/Lib/trace.py	Thu Apr 10 21:02:25 2008
@@ -249,19 +249,15 @@
         if self.calledfuncs:
             print()
             print("functions called:")
-            calls = self.calledfuncs.keys()
-            calls.sort()
-            for filename, modulename, funcname in calls:
+            for filename, modulename, funcname in sorted(calls.keys()):
                 print(("filename: %s, modulename: %s, funcname: %s"
                        % (filename, modulename, funcname)))
 
         if self.callers:
             print()
             print("calling relationships:")
-            calls = self.callers.keys()
-            calls.sort()
             lastfile = lastcfile = ""
-            for ((pfile, pmod, pfunc), (cfile, cmod, cfunc)) in calls:
+            for ((pfile, pmod, pfunc), (cfile, cmod, cfunc)) in sorted(self.callers.keys()):
                 if pfile != lastfile:
                     print()
                     print("***", pfile, "***")
@@ -318,10 +314,8 @@
                 sums[modulename] = n_lines, percent, modulename, filename
 
         if summary and sums:
-            mods = sums.keys()
-            mods.sort()
             print("lines   cov%   module   (path)")
-            for m in mods:
+            for m in sorted(sums.keys()):
                 n_lines, percent, modulename, filename = sums[m]
                 print("%5d   %3d%%   %s   (%s)" % sums[m])
 

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Apr 10 21:02:25 2008
@@ -25,6 +25,8 @@
 Library
 -------
 
+- Bug #2606: Avoid calling .sort() on a dict_keys object.
+
 - The bundled libffi copy is now in sync with the recently released
   libffi3.0.5 version, apart from some small changes to
   Modules/_ctypes/libffi/configure.ac.


More information about the Python-3000-checkins mailing list