#17616: wave.open now supports the 'with' statement.

Feature and tests by ClClaudiu.Popa, I added the doc changes.
This commit is contained in:
R David Murray 2013-07-31 13:46:08 -04:00
parent 0ce642ebca
commit c91d5eea10
6 changed files with 45 additions and 12 deletions

View file

@ -167,6 +167,13 @@ class Wave_read:
def __del__(self):
self.close()
def __enter__(self):
return self
def __exit__(self, *args):
self.close()
#
# User visible methods.
#
@ -323,6 +330,12 @@ class Wave_write:
def __del__(self):
self.close()
def __enter__(self):
return self
def __exit__(self, *args):
self.close()
#
# User visible methods.
#