[Python-checkins] r47217 - in python/branches/release24-maint: Lib/test/test_descr.py Misc/NEWS Objects/descrobject.c
martin.v.loewis
python-checkins at python.org
Mon Jul 3 15:47:31 CEST 2006
Author: martin.v.loewis
Date: Mon Jul 3 15:47:29 2006
New Revision: 47217
Modified:
python/branches/release24-maint/Lib/test/test_descr.py
python/branches/release24-maint/Misc/NEWS
python/branches/release24-maint/Objects/descrobject.c
Log:
Put method-wrappers into trashcan. Fixes #927248.
Modified: python/branches/release24-maint/Lib/test/test_descr.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_descr.py (original)
+++ python/branches/release24-maint/Lib/test/test_descr.py Mon Jul 3 15:47:29 2006
@@ -3936,6 +3936,13 @@
o.whatever = Provoker(o)
del o
+def wrapper_segfault():
+ # SF 927248: deeply nested wrappers could cause stack overflow
+ f = lambda:None
+ for i in xrange(1000000):
+ f = f.__call__
+ f = None
+
# Fix SF #762455, segfault when sys.stdout is changed in getattr
def filefault():
if verbose:
@@ -4075,6 +4082,7 @@
def test_main():
weakref_segfault() # Must be first, somehow
+ wrapper_segfault()
do_this_first()
class_docstrings()
lists()
Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS (original)
+++ python/branches/release24-maint/Misc/NEWS Mon Jul 3 15:47:29 2006
@@ -12,6 +12,9 @@
Core and builtins
-----------------
+- Bug #927248: Recursive method-wrapper objects can now safely
+ be released.
+
- Bug #992017: A classic class that defined a __coerce__() method that returned
its arguments swapped would infinitely recurse and segfault the interpreter.
Modified: python/branches/release24-maint/Objects/descrobject.c
==============================================================================
--- python/branches/release24-maint/Objects/descrobject.c (original)
+++ python/branches/release24-maint/Objects/descrobject.c Mon Jul 3 15:47:29 2006
@@ -904,10 +904,12 @@
static void
wrapper_dealloc(wrapperobject *wp)
{
- _PyObject_GC_UNTRACK(wp);
+ PyObject_GC_UnTrack(wp);
+ Py_TRASHCAN_SAFE_BEGIN(wp)
Py_XDECREF(wp->descr);
Py_XDECREF(wp->self);
PyObject_GC_Del(wp);
+ Py_TRASHCAN_SAFE_END(wp)
}
static PyMethodDef wrapper_methods[] = {
More information about the Python-checkins
mailing list