Antoine Pitrou added the comment: > 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 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17810> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com