This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alastairp
Recipients alastairp
Date 2012-09-01.22:33:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346538823.6.0.158703748918.issue15843@psf.upfronthosting.co.za>
In-reply-to
Content
Passing a unicode filename to aifc.open() results in the argument being treated like a filepointer instead of opening the file.

The argument check,
http://hg.python.org/cpython/file/default/Lib/aifc.py#l332
only checks if the argument is a str. Should this be extended to accept all string-type objects?

Example usage:
>>> import aifc
>>> aifc.open(u"/some/path")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/aifc.py", line 924, in open
    return Aifc_read(f)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/aifc.py", line 335, in __init__
    self.initfp(f)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/aifc.py", line 286, in initfp
    chunk = Chunk(file)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/chunk.py", line 61, in __init__
    self.chunkname = file.read(4)
AttributeError: 'unicode' object has no attribute 'read'
History
Date User Action Args
2012-09-01 22:33:43alastairpsetrecipients: + alastairp
2012-09-01 22:33:43alastairpsetmessageid: <1346538823.6.0.158703748918.issue15843@psf.upfronthosting.co.za>
2012-09-01 22:33:43alastairplinkissue15843 messages
2012-09-01 22:33:42alastairpcreate