Message187878
| Author |
pitrou |
| Recipients |
Arfrever, alexandre.vassalotti, asvetlov, neologix, pitrou, rhettinger, serhiy.storchaka |
| Date |
2013年04月26日.21:45:14 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1367012712.2558.2.camel@fsol> |
| In-reply-to |
<1367012542.84.0.428648045906.issue17810@psf.upfronthosting.co.za> |
| Content |
> What if just use io.BufferedReader?
>
> if not isinstance(file, io.BufferedReader):
> file = io.BufferedReader(file)
>
> (at start of _Unpickler.__init__)
Two problems:
1. semantically, it is wrong; the BufferedReader will read bytes beyond
the pickle end, so the underlying stream will be desynchronized
2. performance-wise, it doesn't solve the issue either: read() method
calls are costly, even on an optimized C object |
|