This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients eric.araujo, jaraco, orsenthil, pitrou
Date 2011-07-25.13:56:40
SpamBayes Score 1.7598846e-06
Marked as misclassified No
Message-id <>
I looked into the possibility of retaining newline characters even for files with mixed newlines, but I've decided that's too intrusive an approach. The current implementation specifically takes measures to strip whitespaces from the ends of lines, so it seems outside the scope of this bug to alter that behavior.

So I've taken another stab at a more robust implementation that does newline detection but raises an error if the file contains mixed newlines.

Furthermore, it adds an option (--newline) to specify which newline character to use, bypassing the mixed-newline error and allowing the user to override newline detection.

Here's a demo run:

    PS C:\cpython-issue10639> python .\Tools\scripts\ .\
    .\ mixed newlines detected; cannot continue without --newline
    PS C:\cpython-issue10639> python .\Tools\scripts\ --newline CRLF .\
    PS C:\cpython-issue10639> python .\Tools\scripts\ --newline LF .\
    PS C:\cpython-issue10639> python .\Tools\scripts\ .\

I've published this change as

Please review. If this changeset is acceptable, I will push the revisions to the master repo. Please advise if I may also backport to Python 3.2 and 2.7.
Date User Action Args
2011-07-25 13:56:41jaracosetrecipients: + jaraco, orsenthil, pitrou, eric.araujo
2011-07-25 13:56:41jaracosetmessageid: <>
2011-07-25 13:56:41jaracolinkissue10639 messages
2011-07-25 13:56:40jaracocreate