Message11139

Author jamesmudd
Recipients fwierzbicki, jamesmudd, ldias, pradeeppanayal, zyasoft
Date 2017-02-27.18:56:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488221776.41.0.555909242335.issue2466@psf.upfronthosting.co.za>
In-reply-to
Content
I have looked at this a bit more and have a few more examples which seem strange

>>> print "some text
  File "<stdin>", line 1
    print "some text
    ^
SyntaxError: no viable alternative at input '<EOF>'
>>> exec('print "some text')

>>> exec('print \'some text')

>>> 

print "some text - correctly produces a SyntaxError however exec('print "some text') just prints a blank line like exec('print') would. This behaviour is also reproduced with a escaped single quote.

If you call print('some text') then it always seems to work correctly
>>> print("some text
  File "<stdin>", line 1
    print("some text
        ^
SyntaxError: no viable alternative at input '<EOF>'
>>> print("some text)
  File "<stdin>", line 1
    print("some text)
        ^
SyntaxError: no viable alternative at input '<EOF>'
>>> print("some text")
some text
>>> print('some text
  File "<stdin>", line 1
    print('some text
        ^
SyntaxError: no viable alternative at input '<EOF>'
>>> print('some text)
  File "<stdin>", line 1
    print('some text)
        ^
SyntaxError: no viable alternative at input '<EOF>'
>>> print('some text')
some text
>>> exec('print('some text')')
  File "<stdin>", line 1
    exec('print('some text')')
                ^
SyntaxError: no viable alternative at input 'some'
>>> exec('print(\'some text\')')
some text
>>> exec('print("some text")')
some text
>>>
History
Date User Action Args
2017-02-27 18:56:16jamesmuddsetmessageid: <1488221776.41.0.555909242335.issue2466@psf.upfronthosting.co.za>
2017-02-27 18:56:16jamesmuddsetrecipients: + jamesmudd, fwierzbicki, zyasoft, pradeeppanayal, ldias
2017-02-27 18:56:16jamesmuddlinkissue2466 messages
2017-02-27 18:56:16jamesmuddcreate