Bugs item #1190011, was opened at 2005-04-26 16:10
Message generated for change (Comment added) made by ncoghlan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1190011&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: AST
Status: Open
Resolution: None
Priority: 5
Submitted By: Brett Cannon (bcannon)
Assigned to: Nick Coghlan (ncoghlan)
Summary: [AST] distinct code objects not created

Initial Comment:
>> def f(): return ((lambda x=1: x), (lambda x=2: x))
>> f1, f2 = f()
>> id(f1.func_code) != id(f2.func_code)

The above does not hold true.  It should according to
test_compile (reported in HEAD as bug #1048870).

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

>Comment By: Nick Coghlan (ncoghlan)
Date: 2005-05-28 22:11

Message:
Logged In: YES 
user_id=1038590

The same fix mwh used for HEAD appears to work for the AST 
branch, too (it's just in a different source file). Patch attached, and 
kicking in Brett's direction for review. 

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

Comment By: Nick Coghlan (ncoghlan)
Date: 2005-05-28 21:02

Message:
Logged In: YES 
user_id=1038590

For the code above, Python 2.4.1 actually generates a single
code object (that is, the comparison returns False).

Looking closer at 1048870, this is expected, as the two
lambdas are created on the same line. I'll look into this on
the AST branch - I suspect the culprit may be our problems
with getting the line numbering right.

(FWIW, I worked out the UnboundLocal problem, and followed
it up in the relevant bug, 1186353)

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

Comment By: Nick Coghlan (ncoghlan)
Date: 2005-05-28 18:26

Message:
Logged In: YES 
user_id=1038590

This seems to be the least of lambda's problems. A number of
regression tests currently fail with UnboundLocalErrors,
after an argument of the form "lambda (x, y): x" is passed
to a function for invocation.

Assigning to myself, since I'm about to take a look at the
current misbehaviour of lambdas (they must be simpler than
genexps, right?)

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1190011&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