summaryrefslogtreecommitdiffstats
path: root/Lib/trace.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-04-10 19:02:25 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-04-10 19:02:25 (GMT)
commit8efc62cc3f2df2ec0f26a2c4083fc6ed6a8f597b (patch)
tree6ce5c86c01ba03f2d3bfa2f04a2516d270b5ee0b /Lib/trace.py
parente2ae4684a5617ec5bc8d48e09af2dd7a24711f23 (diff)
downloadcpython-8efc62cc3f2df2ec0f26a2c4083fc6ed6a8f597b.zip
cpython-8efc62cc3f2df2ec0f26a2c4083fc6ed6a8f597b.tar.gz
cpython-8efc62cc3f2df2ec0f26a2c4083fc6ed6a8f597b.tar.bz2
Bug #2606: Avoid calling .sort() on a dict_keys object.
Diffstat (limited to 'Lib/trace.py')
-rw-r--r--Lib/trace.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/trace.py b/Lib/trace.py
index 06b72b7..a5c2f11 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])