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: compiler module does not detect a syntax error
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: georg.brandl, harripasanen, jhylton, nnorwitz
Priority: normal Keywords:

Created on 2005-12-19 09:58 by harripasanen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
compiler-defaultargs.diff georg.brandl, 2006-04-30 20:20
Messages (5)
msg27105 - (view) Author: Harri Pasanen (harripasanen) Date: 2005-12-19 09:58
import compiler 
compiler.parse("def foo(a=1,b): pass") 
 
Gives: 
 
Module(None, Stmt([Function(None, 'foo', ['a', 'b'], 
[Const(1)], 0, None, Stmt([Pass()]))])) 
 
However, the python interpreter itself barks for the 
same code: 
 
SyntaxError: non-default argument follows default 
argument 
 
 
-Harri 
 
 
msg27106 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-02-25 21:59
Logged In: YES 
user_id=33168

FYI.
msg27107 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-04-30 20:20
Logged In: YES 
user_id=849994

Attaching patch. Please review.
msg27108 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-05-01 07:21
Logged In: YES 
user_id=33168

Any reason you do:
  not i >= len(nodelist) 

instead of:
  i < len(nodelist)

?

The patch seems fine if everything passes with -u compiler
test_compiler.
msg27109 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-05-03 18:19
Logged In: YES 
user_id=849994

Thanks for spotting the quirk.

Applied as rev. 45893. test_compiler passes fine here.
History
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42710
2005-12-19 09:58:07harripasanencreate