Jason R. Coombs <jar...@jaraco.com> added the comment: What do you think about this: https://bitbucket.org/jaraco/cpython-issue10639/changeset/ea63310dddce
The patch is a little more intrusive than the Python 3 patch because Python 2.7 doesn't allow specifying the newline to use when writing a file (afaict), but it abstracts that intrusiveness in the NewlineAdapter class. I've tested the script on a file with mixed newlines, a file with non-native newlines, and a file with content but no newlines, and it performs as expected. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10639> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com