Bugs item #1479099, was opened at 2006-04-30 00:00
Message generated for change (Comment added) made by zseil
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1479099&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parser/Compiler
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Ori Peleg (oripel)
Assigned to: Nobody/Anonymous (nobody)
Summary: 'compile' built-in function failures when missing EOL

Initial Comment:
The 'compile' built-in function sometimes fails when
given a source string that doesn't end in an EOL.

The following example crashes Python 2.3, 2.4, and 2.5a1:

prompt> ./python2.5 -c "compile('def foo(x):\n
pass\n#abc', 'blah.py', 'exec')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "blah.py", line 3
    #abc
      ^
SyntaxError: invalid syntax

Attached is a patch to Lib/test/test_compile.py with a
test for this.

----------------------------------------------------------------------

Comment By: Žiga Seilnacht (zseil)
Date: 2006-05-19 22:26

Message:
Logged In: YES 
user_id=1326842

This is a documented limitation of compile. The docs
say "the input must be terminated by at least one
newline character". See:
http://docs.python.org/lib/built-in-funcs.html#l2h-16

I would say that this is a bug in the trace module
(compare trace.find_executable_module and
py_compile.compile).

----------------------------------------------------------------------

Comment By: Ori Peleg (oripel)
Date: 2006-04-30 00:07

Message:
Logged In: YES 
user_id=1131251

The case that led me to this was calling
'trace.find_executable_linenos' on source files with this
condition.

See also
https://opensvn.csie.org/traccgi/testoob/trac.cgi/ticket/206

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1479099&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to