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.

classification
Title: compileall doesn't notice syntax errors
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: georg.brandl, isandler, jhylton, jvr, nnorwitz, pm67nz
Priority: normal Keywords:

Created on 2001-03-30 10:59 by anonymous, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
diff jhylton, 2001-04-13 14:31
py_compile.patch jvr, 2003-01-03 12:29 py_compile.py patch against rev. 1.23
Messages (10)
msg4128 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-03-30 10:59
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.
msg4129 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-04-13 14:31
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.
msg4130 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-04-13 21:16
Logged In: YES 
user_id=31392

Will fix following the 2.1 release
msg4131 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2001-04-18 01:23
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.
msg4132 - (view) Author: Peter Maxwell (pm67nz) Date: 2001-09-10 03:31
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.
msg4133 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-01-03 12:29
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.
msg4134 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-01-05 20:25
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).
msg4135 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-01-05 21:01
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?
msg4136 - (view) Author: Ilya Sandler (isandler) Date: 2005-04-27 03:58
Logged In: YES 
user_id=971153


I did a small test

   ~>echo '"garab' > garbage.py 
   ~>python -m compileall .

and got expected:
SyntaxError: EOL while scanning single-quoted string

and exit status of 1

So the problem is fixed in latest python and bug can be closed
msg4137 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-05 17:34
Logged In: YES 
user_id=1188172

Closing as Fixed, then.
History
Date User Action Args
2022-04-10 16:03:54adminsetgithub: 34256
2001-03-30 10:59:09anonymouscreate