Repository navigation
Commit 378bd3e
committed
Accept falsy file-like objects in the C Unpacker
Unpacker.__init__ in the C extension used `if file_like:` before saving
`file_like.read`. A stream that defines __bool__ or __len__ and is falsy
(for example werkzeug's FileStorage without a filename) was stored as the
input but its read method was not, so the first read failed with
"TypeError: 'NoneType' object is not callable". The pure Python Unpacker
checks `file_like is None` and works.
Check `file_like is not None` instead and add a regression test.1 parent 8a88e3d commit 378bd3e
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
| 363 | + | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
90 | 105 | | |
91 | 106 | | |
92 | 107 | | |
| |||
0 commit comments