]> granicus.if.org Git - python/commitdiff
Fix SF #1001053, wave.open() with unicode filename fails
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 1 Aug 2004 22:48:06 +0000 (22:48 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 1 Aug 2004 22:48:06 +0000 (22:48 +0000)
Backport candidate.

Lib/wave.py
Misc/NEWS

index 29e15a0182fe9e38d0d39d6a354310e7580c7c22..08c51ba90c163cb1237ae51b9babca2f539337ff 100644 (file)
@@ -155,7 +155,7 @@ class Wave_read:
 
     def __init__(self, f):
         self._i_opened_the_file = None
-        if type(f) == type(''):
+        if isinstance(f, basestring):
             f = __builtin__.open(f, 'rb')
             self._i_opened_the_file = f
         # else, assume it is an open file object already
@@ -294,7 +294,7 @@ class Wave_write:
 
     def __init__(self, f):
         self._i_opened_the_file = None
-        if type(f) == type(''):
+        if isinstance(f, basestring):
             f = __builtin__.open(f, 'wb')
             self._i_opened_the_file = f
         self.initfp(f)
index 361a276f859a60630a700160b66fefbcff4e4a98..d142c3d15e621b516ae1f8d6e53af5a8995ca30a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,8 @@ Extension modules
 Library
 -------
 
+- Bug #1001053.  wave.open() now accepts unicode filenames.
+
 - gzip.GzipFile has a new fileno() method, to retrieve the handle of the
   underlying file object (provided it has a fileno() method).  This is
   needed if you want to use os.fsync() on a GzipFile.