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: leak on lambda with duplicate arguments error
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jhylton Nosy List: jhylton, mwh
Priority: normal Keywords:

Created on 2003-09-18 14:43 by mwh, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
compile-leak.diff mwh, 2003-09-19 10:04 fixity fix
Messages (4)
msg18203 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-09-18 14:43
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.
msg18204 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2003-09-19 10:04
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...
msg18205 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2003-09-22 04:32
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.
msg18206 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2003-09-22 04:35
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.
History
Date User Action Args
2022-04-10 16:11:13adminsetgithub: 39253
2003-09-18 14:43:13mwhcreate