Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(117109)

Unified Diff: Lib/wave.py

Issue 17616: wave.Wave_read and wave.Wave_write can be context managers
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_wave.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/wave.py Mon Apr 01 17:43:30 2013 -0400
+++ b/Lib/wave.py Tue Apr 02 12:10:40 2013 +0300
@@ -168,6 +168,13 @@
def __del__(self):
self.close()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.close()
+
#
# User visible methods.
#
@@ -324,6 +331,12 @@
def __del__(self):
self.close()
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.close()
+
#
# User visible methods.
#
« no previous file with comments | « Lib/test/test_wave.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+