summaryrefslogtreecommitdiffstats
path: root/Lib/contextlib.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-10-17 13:40:57 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-10-17 13:40:57 (GMT)
commit240f86d7ddbeb3800d39a6d2e6e7a7d1f0c49799 (patch)
treeec61711162ebf82864716dee27119461c312ba58 /Lib/contextlib.py
parent1eb509a585c402faa76da85095f1bdae5cd54ef2 (diff)
downloadcpython-240f86d7ddbeb3800d39a6d2e6e7a7d1f0c49799.zip
cpython-240f86d7ddbeb3800d39a6d2e6e7a7d1f0c49799.tar.gz
cpython-240f86d7ddbeb3800d39a6d2e6e7a7d1f0c49799.tar.bz2
Close #19266: contextlib.ignore -> contextlib.suppress
Patch by Zero Piraeus.
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r--Lib/contextlib.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index 41ff9cc..144d6bb 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -5,7 +5,7 @@ from collections import deque
from functools import wraps
__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack",
- "ignore", "redirect_stdout"]
+ "redirect_stdout", "suppress"]
class ContextDecorator(object):
@@ -179,10 +179,10 @@ class redirect_stdout:
sys.stdout = self.old_target
@contextmanager
-def ignore(*exceptions):
- """Context manager to ignore specified exceptions
+def suppress(*exceptions):
+ """Context manager to suppress specified exceptions
- with ignore(OSError):
+ with suppress(OSError):
os.remove(somefile)
"""