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: Python segfaults when freeing "deep" objects
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, exarkun, georg.brandl, hyeshik.chang, jimjjewett, loewis, smulloni
Priority: high Keywords:

Created on 2004-04-01 04:07 by exarkun, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (8)
msg20405 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2004-04-01 04:07
An example to produce this behavior:

>>> f = lambda: None
>>> for i in range(1000000):
...     f = f.__call__
... 
>>> f = None
Segmentation fault
msg20406 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2004-04-01 05:21
Logged In: YES 
user_id=55188

Oh. my patch doesn't fix another scenario that using
recursive by two or more types of slots. So I remove.
msg20407 - (view) Author: Jim Jewett (jimjjewett) Date: 2004-04-05 00:32
Logged In: YES 
user_id=764593

CVS for 2.4 has comments for (and a fix for) problems similar 
to this.  Does the bug still exist with that source code?
msg20408 - (view) Author: Jacob Smullyan (smulloni) Date: 2004-04-08 03:20
Logged In: YES 
user_id=108556

Python CVS as of April 7th consistently segfaults with the
above example for me:

smulloni@bracknell src $ ~/apps/python-cvs/bin/python
Python 2.4a0 (#1, Apr  7 2004, 23:10:34) 
[GCC 3.3.2 20031218 (Gentoo Linux 3.3.2-r5,
propolice-3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> f=lambda: None
>>> for x in xrange(1000000):
...     f=f.__call__
... 
>>> f=None
Segmentation fault

Of course, maybe that's a good thing :).
msg20409 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-06-02 19:25
Logged In: YES 
user_id=89016

Python CVS from 2004-06-02 seems to work:
Python 2.4a0 (#5, Jun  2 2004, 20:23:30) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
>>> f = lambda: None
>>> for x in xrange(1000000):
...  f = f.__call__
... 
>>> f
<method-wrapper object at 0x4259478c>
>>> f = None
>>> f
>>>
msg20410 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-01-10 21:54
Logged In: YES 
user_id=1188172

CVS HEAD of 2006/01/10 still segfaults (here GCC 3.4.5).

Segfault occurs at wrapper_dealloc in descrobject.c.
msg20411 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2006-01-10 22:05
Logged In: YES 
user_id=366566

Note that in doerwalter transcript, _ is still bound to the
method wrapper, preventing Python from attempting to free it.
msg20412 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-07-03 13:48
Logged In: YES 
user_id=21627

This is now fixed in r47217 and r47218, by putting the
method-wrapper objects into the trashcan.
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40113
2004-04-01 04:07:17exarkuncreate