summaryrefslogtreecommitdiff
path: root/Lib/aifc.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-29 23:11:20 +0200
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-29 23:11:20 +0200
commit9edccb47db7683031e76f02e659e637cf04ba2d7 (patch)
tree4e8eb0908f5a503117615adc66dbf54a5fa997db /Lib/aifc.py
parentf0724e7695ac427d64f68c785a2da8abd2ec01f5 (diff)
parent44c66c72c9045a7824d07175cfc07845e4d7d28a (diff)
downloadcpython-git-9edccb47db7683031e76f02e659e637cf04ba2d7.tar.gz
merge heads
Diffstat (limited to 'Lib/aifc.py')
-rw-r--r--Lib/aifc.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py
index a19b38f4aa..67ea5dadc0 100644
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -334,6 +334,12 @@ class Aifc_read:
# else, assume it is an open file object already
self.initfp(f)
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.close()
+
#
# User visible methods.
#
@@ -553,6 +559,12 @@ class Aifc_write:
def __del__(self):
self.close()
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.close()
+
#
# User visible methods.
#