Open yx1994 opened 1 year ago
Nothing considered it because it wasn't intended to be supported. We could more explicitly error on this, @pquentin
Well, if wrapping it as a FileWrapper
works maybe we could do that automatically in coerce_data
?
If we land this for urllib3, sure. I'm not convinced this library needs feature work, even if it's low hanging fruit like this
MultipartEncoder can't handle mmap.mmap object correctly.
MultipartEncoder
can't handlemmap.mmap
object correctly. For example,it will fall into an infinity loop in
m.read()
.I review those source code, find that the
coerce_data
function did't consider about themmap.mmap
object. Then thetotal_len
function work different from other io object (always return the origin size). Then thebytes_left_to_write
function always returnTrue
, fall into the infinity loop.In my opinion, judge the
mmap.mmap
object byisinstance(data, mmap.mmap)
orhasattr(data, 'madvise')
, or other method?Now, I fix my code by manually wrapped with
FileWrapper
, asI have little experience to pull requests. Could someone fix it from this package?