]> granicus.if.org Git - python/commitdiff
Issue #16261: fix bare excepts in Doc/
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Fri, 2 Nov 2012 20:07:26 +0000 (22:07 +0200)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Fri, 2 Nov 2012 20:07:26 +0000 (22:07 +0200)
Doc/howto/logging-cookbook.rst
Doc/library/timeit.rst
Doc/library/traceback.rst

index 92af0ec585ed4f82c4fb90df351669790d0f9e82..b336a4ad8a64fc75052c13a8878992ace16023c4 100644 (file)
@@ -741,9 +741,7 @@ the basis for code meeting your own specific requirements::
                     break
                 logger = logging.getLogger(record.name)
                 logger.handle(record) # No level or filter logic applied - just do it!
-            except (KeyboardInterrupt, SystemExit):
-                raise
-            except:
+            except Exception:
                 import sys, traceback
                 print('Whoops! Problem:', file=sys.stderr)
                 traceback.print_exc(file=sys.stderr)
index a4879179249176a55b9880168401215c65e579ce..0cc15868db6a833c6903790a43d71ea66ba659a8 100644 (file)
@@ -151,7 +151,7 @@ The module defines three convenience functions and a public class:
          t = Timer(...)       # outside the try/except
          try:
              t.timeit(...)    # or t.repeat(...)
-         except:
+         except Exception:
              t.print_exc()
 
       The advantage over the standard traceback is that source lines in the
index 32e57337fae57a18cb72398f9f4048d2353a88b7..0533beaf8c324103bfeb665836d377fb98a37b51 100644 (file)
@@ -146,7 +146,7 @@ module. ::
        source = input(">>> ")
        try:
            exec(source, envdir)
-       except:
+       except Exception:
            print("Exception in user code:")
            print("-"*60)
            traceback.print_exc(file=sys.stdout)