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 steven.winfield
Recipients BreamoreBoy, benjamin.peterson, eryksun, miwa, nedbat, schlamar, steven.winfield, tim.golden, vstinner, zach.ware
Date 2017-08-08.16:06:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502208418.45.0.773715915442.issue20844@psf.upfronthosting.co.za>
In-reply-to
Content
I've just been bitten by this on 3.6.2, Windows Server 2008 R2, when running the setup.py script for QuantLib-SWIG:
https://github.com/lballabio/QuantLib-SWIG/blob/v1.10.x/Python/setup.py

It seems there is different behaviour depending on whether:
  * Unix (LF) or Windows (CRLF) line endings are used
  * The file is >4096 bytes or <=4096 bytes
  * The module docstring has an initial space

Some of that has been mentioned previously, but I think the 4096-byte limit might be new, which is why I'm posting.

I've attached a script I used to come up with the results below. It contains:
  * a -*- coding line (for iso-8859-1 in this case)
  * a docstring consisting entirely of lines of x's, of length 78
  * Unix line endings

The file's length is exactly 4096 bytes.

Running this, or slightly modified versions of this, with a 3.6.2 interpreter gave the following results:

  * In all cases, when Windows line endings were used there was no issue - running the script produced no errors or output.

  * With Unix line endings:

    * File length <= 4096, with no leading spaces in the docstring:
	  File "issue20844.py", line 1
	SyntaxError: encoding problem: iso-8859-1

    * File length > 4096, with no leading spaces in the docstring:
	  File "issue20844.py", line 56
		xxxxx"""
			   ^
	SyntaxError: EOF while scanning triple-quoted string literal


    * Any file length, with the first 'x' on line 3 replaced with a space (line 2 if the coding line is ignored):
	  File "issue20844.py", line 2
		xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
		^
	IndentationError: unexpected indent

I had no issues with python 2.7.13.
History
Date User Action Args
2017-08-08 16:06:58steven.winfieldsetrecipients: + steven.winfield, vstinner, nedbat, tim.golden, benjamin.peterson, miwa, BreamoreBoy, schlamar, zach.ware, eryksun
2017-08-08 16:06:58steven.winfieldsetmessageid: <1502208418.45.0.773715915442.issue20844@psf.upfronthosting.co.za>
2017-08-08 16:06:58steven.winfieldlinkissue20844 messages
2017-08-08 16:06:57steven.winfieldcreate