Kaydet (Commit) d5cfa549 authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Put method-wrappers into trashcan. Fixes #927248.

üst ede77f53
...@@ -3966,6 +3966,13 @@ def weakref_segfault(): ...@@ -3966,6 +3966,13 @@ def weakref_segfault():
o.whatever = Provoker(o) o.whatever = Provoker(o)
del 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 # Fix SF #762455, segfault when sys.stdout is changed in getattr
def filefault(): def filefault():
if verbose: if verbose:
...@@ -4121,6 +4128,7 @@ def notimplemented(): ...@@ -4121,6 +4128,7 @@ def notimplemented():
def test_main(): def test_main():
weakref_segfault() # Must be first, somehow weakref_segfault() # Must be first, somehow
wrapper_segfault()
do_this_first() do_this_first()
class_docstrings() class_docstrings()
lists() lists()
......
...@@ -12,6 +12,9 @@ What's New in Python 2.5 beta 2? ...@@ -12,6 +12,9 @@ What's New in Python 2.5 beta 2?
Core and builtins Core and builtins
----------------- -----------------
- Bug #927248: Recursive method-wrapper objects can now safely
be released.
- Bug #1417699: Reject locale-specific decimal point in float() - Bug #1417699: Reject locale-specific decimal point in float()
and atof(). and atof().
......
...@@ -892,10 +892,12 @@ typedef struct { ...@@ -892,10 +892,12 @@ typedef struct {
static void static void
wrapper_dealloc(wrapperobject *wp) wrapper_dealloc(wrapperobject *wp)
{ {
_PyObject_GC_UNTRACK(wp); PyObject_GC_UnTrack(wp);
Py_TRASHCAN_SAFE_BEGIN(wp)
Py_XDECREF(wp->descr); Py_XDECREF(wp->descr);
Py_XDECREF(wp->self); Py_XDECREF(wp->self);
PyObject_GC_Del(wp); PyObject_GC_Del(wp);
Py_TRASHCAN_SAFE_END(wp)
} }
static int static int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment