Message206299
imghdr.what check explicitly for string path, while `open` happily accepts bytes paths, as seen below:
>>> x
b'\xc2\xba'
>>> imghdr.what(x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tank/libs/cpython/Lib/imghdr.py", line 15, in what
location = file.tell()
AttributeError: 'bytes' object has no attribute 'tell'
>>> open(x)
<_io.TextIOWrapper name=b'\xc2\xba' mode='r' encoding='UTF-8'>
A reason why this should be supported can be found in this message: http://bugs.python.org/msg191691.
The following patch fixes this. Also, it depends on issue19990 (where test_imghdr.py was added). |
|
Date |
User |
Action |
Args |
2013-12-16 12:48:13 | Claudiu.Popa | set | recipients:
+ Claudiu.Popa |
2013-12-16 12:48:13 | Claudiu.Popa | set | messageid: <1387198093.92.0.388328564702.issue19997@psf.upfronthosting.co.za> |
2013-12-16 12:48:13 | Claudiu.Popa | link | issue19997 messages |
2013-12-16 12:48:13 | Claudiu.Popa | create | |
|