[Python-bugs-list] [ python-Bugs-412436 ] compileall doesn't notice syntax errors

SourceForge.net noreply@sourceforge.net
Sun, 05 Jan 2003 13:01:10 -0800


Bugs item #412436, was opened at 2001-03-30 12:59
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=412436&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Jeremy Hylton (jhylton)
Summary: compileall doesn't notice syntax errors

Initial Comment:
compileall.py returns an exit code to indicate the
success or failure of compilation.  This feature was
added in compileall.py revision 1.7 in response to
distutils message 
http://mail.python.org/pipermail/distutils-sig/1999-March/000201.html

This is not as useful as it looks because a prior
change to py_compile.py (revision 1.13) catches syntax
errors, hiding them completely from compileall.py, so
compileall.py can't report the failure to its caller.


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

>Comment By: Just van Rossum (jvr)
Date: 2003-01-05 22:01

Message:
Logged In: YES 
user_id=92689

The change to compileall.py has been in CVS for a long time.
The strange thing is that the accompanying py_compile.py
patch wasn't checked in. All I did was update that change
for current CVS. Jeremy?

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-05 21:25

Message:
Logged In: YES 
user_id=33168

I definitely think Just's change to py_compile.py (return 0
or 1 from compile()) should be checked in.  This doesn't
hurt and is backwards compatible.  I think a NEWS entry and
doc updates (Doc/lib/libpycompile.tex) should be done as well.

The change to compileall.py is also probably ok, but I
didn't look as closely (the patch failed to apply for me in
2.3).

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

Comment By: Just van Rossum (jvr)
Date: 2003-01-03 13:29

Message:
Logged In: YES 
user_id=92689

Reopening this bug as it's entirely unclear why the
py_compile.py change wasn't checked in. This has resulted in
a new bug, #653301.

I've attached a patch that's updated for current CVS (rev.
1.23 of py_compile.py).

Since py_compile.py is crucial to the install process I'd
rather have someone else make the decision to check this in
or not.

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

Comment By: Peter Maxwell (pm67nz)
Date: 2001-09-10 05:31

Message:
Logged In: YES 
user_id=320286

I don't see how this can be fixed in compileall.py since the
problem 
is with py_compile.py.  py_compile.compile (up to and
including the 
latest version I see in CVS, revision 1.18) only ever
returns None, 
so the code in compileall.py revision 1.19 that says:
   ok = py_compile.compile(fullname, None, dfile)
and 
   if ok == 0:
can't possibly work.
Caveat: this comment based on reading code, not running it.


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

Comment By: Jeremy Hylton (jhylton)
Date: 2001-04-18 03:23

Message:
Logged In: YES 
user_id=31392

Fixed in rev 1.9 of compileall.py.  Note that this fix
causes a bunch of changes to the test suite, so that files
containing syntaxerrors are not compiled by compileall.


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

Comment By: Jeremy Hylton (jhylton)
Date: 2001-04-13 23:16

Message:
Logged In: YES 
user_id=31392

Will fix following the 2.1 release


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

Comment By: Jeremy Hylton (jhylton)
Date: 2001-04-13 16:31

Message:
Logged In: YES 
user_id=31392

I think this is easy enough to fix, but I don't know what
unintended side-effects the fix will have.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=412436&group_id=5470