[Python-checkins] r74439 - python/branches/tk_and_idle_maintenance/Lib/idlelib/utils.py

guilherme.polo python-checkins at python.org
Fri Aug 14 00:23:44 CEST 2009


Author: guilherme.polo
Date: Fri Aug 14 00:23:43 2009
New Revision: 74439

Log:
Forgot to commit the new utils module.

Added:
   python/branches/tk_and_idle_maintenance/Lib/idlelib/utils.py   (contents, props changed)

Added: python/branches/tk_and_idle_maintenance/Lib/idlelib/utils.py
==============================================================================
--- (empty file)
+++ python/branches/tk_and_idle_maintenance/Lib/idlelib/utils.py	Fri Aug 14 00:23:43 2009
@@ -0,0 +1,12 @@
+import sys
+
+def tb_print_list(extracted_list, file=sys.stderr):
+    """An extended version of traceback.print_list which doesn't include
+    "in <module>" when printing traceback."""
+    for fname, lineno, name, line in extracted_list:
+        if name == '<module>':
+            file.write('  File "%s", line %d\n' % (fname, lineno))
+        else:
+            file.write('  File "%s", line %d, in %s\n' % (fname, lineno, name))
+        if line:
+            file.write('    %s\n' % line.strip())


More information about the Python-checkins mailing list