From: Martin v. Löwis Date: Thu, 10 Apr 2008 19:02:25 +0000 (+0000) Subject: Bug #2606: Avoid calling .sort() on a dict_keys object. X-Git-Tag: v3.0a5~107 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8efc62cc3f2df2ec0f26a2c4083fc6ed6a8f597b;p=thirdparty%2FPython%2Fcpython.git Bug #2606: Avoid calling .sort() on a dict_keys object. --- diff --git a/Lib/trace.py b/Lib/trace.py index 06b72b7de524..a5c2f1104bec 100644 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -249,19 +249,15 @@ class CoverageResults: 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 @@ class CoverageResults: 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]) diff --git a/Misc/NEWS b/Misc/NEWS index 1ff242aaf7a4..beed5cb17054 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -25,6 +25,8 @@ Extension Modules 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.