[Python-bugs-list] [ python-Bugs-808594 ] leak on lambda with duplicate arguments error

SourceForge.net noreply at sourceforge.net
Mon Sep 22 00:35:08 EDT 2003


Bugs item #808594, was opened at 2003-09-18 14:43
Message generated for change (Comment added) made by jhylton
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=808594&group_id=5470

Category: Parser/Compiler
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Michael Hudson (mwh)
Assigned to: Jeremy Hylton (jhylton)
Summary: leak on lambda with duplicate arguments error

Initial Comment:
There's a leak on compiling code like 'lambda a,a:0'. 

TrackRefs says the following are being leaked:



<type 'list'>                                         

        4       16

<type 'str'>                                          

        2       10

<type 'symtable entry'>                               

        2        8

<type 'dict'>                                         

        2        8

<type 'int'>                                          

        0        2



It doesn't seem to leak for, e.g. 'def f(a,a):pass'.



I had a look at the code, but got very confused, I'm

afraid.

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

>Comment By: Jeremy Hylton (jhylton)
Date: 2003-09-22 04:35

Message:
Logged In: YES 
user_id=31392

But a more careful test shows that totalrefcount doesn't go

up if I compile this code in a loop.  So it looks like it's

fixed.



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

Comment By: Jeremy Hylton (jhylton)
Date: 2003-09-22 04:32

Message:
Logged In: YES 
user_id=31392

I changed the code, but I think I still see a leak.  At the

interpreter prompt,

f = lambda a,a: None

shows refs growing by one every time.



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

Comment By: Michael Hudson (mwh)
Date: 2003-09-19 10:04

Message:
Logged In: YES 
user_id=6656

Well, this was easier to fix than I expected (one line patch

attached, which I'll check in soon).



The mystery has transformed itself into "how the hell did

the code work in the first place?" and "why didn't the

function version leak?".



I think I know the answer to the first one, but I'm not

telling :-) I may go as far as posting it to c.l.py as a

Python Mystery Theatre style poser...

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

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



More information about the Python-bugs-list mailing list