[docs] [issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded

Zachary Ware report at bugs.python.org
Fri Feb 28 23:22:39 CET 2014

Zachary Ware added the comment:

For the UTF-7 comment, I'd go with something like "locale encoding is probably not UTF-7" or "UTF-7 is a convenient, seldom used encoding", or something to that effect.

About writeTmp vs. context manager: as you wish.  It would still be good to convert writeTmp to use a context manager though, but that is a separate issue.  Just cleaning up 2.7 to match 3.x is enough to make me happy :)

For the explicit failure message, perhaps the best we can do in 2.7 is a comment saying that the most likely failure is a UnicodeDecodeError due to the entire file being read when it shouldn't have been.  That can be deduced from the separate comments you already have there (and especially from the issue link), but I think it may be better to just come right out and say it.  If exception chaining means the original exception is kept with a self.fail call in 3.x, I think 3.x should get the explicit failure message, though.  I don't feel too strongly about it, though; I'll leave it to you to change or not as you like :)


Python tracker <report at bugs.python.org>

More information about the docs mailing list