Author xxm
Recipients xxm
Date 2021-01-13.06:05:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610517945.87.0.376741027563.issue42919@roundup.psfhosted.org>
In-reply-to
Content
In build-in function compile() of mode 'single',  single statement can be well compiled. (see program 1 and program 2). However,  if we leave 4 blank spaces before the end of triple-quotation mark of "if expression",(see program 3), The parser will raise syntax error. This is not the expected output.  Spaces in the end of multi-line expression should not affect the compilation results. No error should be reported in this case.


program 1 (expected)
===============================
snippet ="""
a = 1
     """
compile(snippet, "", "single")
===============================

program 2 (expected)
===============================
snippet ="""
if True:
     a = 1
"""
compile(snippet, "", "single")
===============================

program 3 (unexpected)
===========================
snippet ="""
if True:
     a = 1
     """
compile(snippet, "", "single")
===========================
Traceback (most recent call last):
     File "/home/xxm/Desktop/nameChanging/report/test1.py", line 1, in <module>
         compile(snippet, "", "single")
     File "", line 4
SyntaxError: unexpected EOF while parsing

Expected output: No error reported (like program1 and program2)


>> python -V
Python 3.10.0a2
>>uname -a
Linux xxm-System-Product-Name 4.15.0-64-generic #73~16.04.1-Ubuntu SMP Fri Sep 13 09:56:18 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
History
Date User Action Args
2021-01-13 06:05:45xxmsetrecipients: + xxm
2021-01-13 06:05:45xxmsetmessageid: <1610517945.87.0.376741027563.issue42919@roundup.psfhosted.org>
2021-01-13 06:05:45xxmlinkissue42919 messages
2021-01-13 06:05:45xxmcreate