[Python-bugs-list] [ python-Bugs-485781 ] get_refer{ent,rer}s() doesn't use `is'
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 29 Nov 2001 10:14:41 -0800
Bugs item #485781, was opened at 2001-11-26 13:16
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485781&group_id=5470
Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Zooko Ozoko (zooko)
Assigned to: Martin v. Löwis (loewis)
Summary: get_refer{ent,rer}s() doesn't use `is'
Initial Comment:
in Python 2.2b2 as packaged by debian,
gc.get_referents() seems to be using equality testing
rather than identity testing to find referents. Example:
>>> l = [0,3,2,{},]
>>> gc.get_referents({})
[Type help() for interactive help, or help(object) for
help about object., [0, 3, 2, {}]]
The list should not have appeared in the result.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2001-11-29 10:14
Message:
Logged In: YES
user_id=21627
The patch has been committed as gcmodule.c 2.31. Since it
fixes *this* bug (about using ==), I'll close this report.
As for the problem you are still seeing: It would be good if
the segfault could be analysed in a debugger (using the old
core file if you cannot reproduce it in a life debugger).
I have the suspicion that this is a different problem:
refs.remove will also use ==, not is. That still shouldn't
cause a segfault, but it appears to be a different bug. If
you have further details, don't hesitate to open a new bug
report.
----------------------------------------------------------------------
Comment By: Zooko Ozoko (zooko)
Date: 2001-11-28 07:52
Message:
Logged In: YES
user_id=52562
Whoops, although it survived an overnight run of
continuously doing `get_referrers({})' (which formerly would
have triggered a seg fault), it did not survive the
following interactive code:
>>> for ref in refs[:]:
... for k, v in locals().items():
... if (ref is k) or (ref is v):
... refs.remove(ref)
...
That got a segfault. `refs' was a list of objects (namely,
all objects in the current runtime that held a reference to
an empty dict.
----------------------------------------------------------------------
Comment By: Zooko Ozoko (zooko)
Date: 2001-11-28 06:39
Message:
Logged In: YES
user_id=52562
Yep! That patch fixes the problem with getting answers I
didn't want *and* it fixes the seg faults!
Now I'm making faster progress on diagnosing memory usage in
Mojo Nation. Whoo-hoo!
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-11-26 23:22
Message:
Logged In: YES
user_id=21627
Please try the attached patch (or report back if you cannot).
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485781&group_id=5470