Kaydet (Commit) 47395617 authored tarafından Andrew Svetlov's avatar Andrew Svetlov

Issue #16261: fix bare excepts in Doc/

üst c38c816e
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment