Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e67fd4

Browse files
committed
Fix SF #1001053, wave.open() with unicode filename fails
Backport candidate.
1 parent 4ecd8cd commit 0e67fd4

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/wave.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def initfp(self, file):
155155

156156
def __init__(self, f):
157157
self._i_opened_the_file = None
158-
if type(f) == type(''):
158+
if isinstance(f, basestring):
159159
f = __builtin__.open(f, 'rb')
160160
self._i_opened_the_file = f
161161
# else, assume it is an open file object already
@@ -294,7 +294,7 @@ class Wave_write:
294294

295295
def __init__(self, f):
296296
self._i_opened_the_file = None
297-
if type(f) == type(''):
297+
if isinstance(f, basestring):
298298
f = __builtin__.open(f, 'wb')
299299
self._i_opened_the_file = f
300300
self.initfp(f)

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Extension modules
4646
Library
4747
-------
4848

49+
- Bug #1001053. wave.open() now accepts unicode filenames.
50+
4951
- gzip.GzipFile has a new fileno() method, to retrieve the handle of the
5052
underlying file object (provided it has a fileno() method). This is
5153
needed if you want to use os.fsync() on a GzipFile.

0 commit comments

Comments
 (0)