Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7364] Traceback contains incorrect line number for duplicate argument in lambda definition

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 19, 2009, 4:36 PM

Post #1 of 2 (138 views)
Permalink
[issue7364] Traceback contains incorrect line number for duplicate argument in lambda definition

New submission from James Lingard <jchl [at] aristanetworks>:

The following python file:

lambda a, a: 0

when executed gives the following backtrace:

File "/tmp/test.py", line 0
SyntaxError: duplicate argument 'a' in function definition

Note that the line number is 0, not 1. (It's always 0, regardless of
the position in the file).

---

Note that this doesn't happen for other similar errors in lambda
functions, for example the file:

lambda a=0, a: 0

leads to the following error message:

File "/tmp/test.py", line 1
lambda a=0, a: 0
SyntaxError: non-default argument follows default argument

and it also doesn't happen for the same error in a 'def':

def f(a, a): pass

leads to the following error message:

File "/tmp/test.py", line 1
def f(a, a): pass
SyntaxError: duplicate argument 'a' in function definition

---

Tested on Python 2.6 (r26:66714, Jun 8 2009, 16:07:29).

----------
components: Interpreter Core
messages: 95518
nosy: james.lingard
severity: normal
status: open
title: Traceback contains incorrect line number for duplicate argument in lambda definition
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7364>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 19, 2009, 5:17 PM

Post #2 of 2 (132 views)
Permalink
[issue7364] Traceback contains incorrect line number for duplicate argument in lambda definition [In reply to]

Benjamin Peterson <benjamin [at] python> added the comment:

Fixed in r76423.

----------
nosy: +benjamin.peterson
resolution: -> fixed
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7364>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.