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 Wilberto
Recipients Wilberto, r.david.murray
Date 2013-09-06.20:13:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I can't provide a example but reading the source comments it seems wrong.

'First, check if the source consists entirely of blank lines and
comments; if so, replace it with 'pass', because the built-in
parser doesn't always do the right thing for these.'

So the way I understand this is.

pure_comments_or_blank = True

for line in source:
    line = line.strip()
    if line and line[0] != '#':
        pure_comments_or_blank = False

if pure_comments_or_blank:
    if symbol != "eval":
        source = "pass"

So check that atleast one line is actual code and not comments or blank. If none is then replace it with a 'pass'

Instead the loop seems a little weird. 

for line in source.split("\n"):
    line = line.strip()
    if line and line[0] != '#':
        break               # Leave it alone
    if symbol != "eval":
        source = "pass"   

If it finds a something that is not a comment in a line it breaks. But then right after the for loop it contains an else statement. I'm not even sure when this else statement is executed. I'm sorry if I'm misinterpreting this.
Date User Action Args
2013-09-06 20:13:09Wilbertosetrecipients: + Wilberto, r.david.murray
2013-09-06 20:13:09Wilbertosetmessageid: <>
2013-09-06 20:13:09Wilbertolinkissue18949 messages
2013-09-06 20:13:09Wilbertocreate