[Python-checkins] r46934 - in python/branches/release24-maint: Misc/NEWS Objects/classobject.c
brett.cannon
python-checkins at python.org
Tue Jun 13 23:50:29 CEST 2006
Author: brett.cannon
Date: Tue Jun 13 23:50:24 2006
New Revision: 46934
Modified:
python/branches/release24-maint/Misc/NEWS
python/branches/release24-maint/Objects/classobject.c
Log:
Classic class that defined ``def __coerce__(self, other): return other, self``
would infinitely recourse and segfault the interpreter. Now a recursion check
occurs after a coercion.
Backport of fix for bug #992017.
Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS (original)
+++ python/branches/release24-maint/Misc/NEWS Tue Jun 13 23:50:24 2006
@@ -12,6 +12,9 @@
Core and builtins
-----------------
+- Bug #992017: A classic class that defined a __coerce__() method that returned
+ its arguments swapped would infinitely recurse and segfault the interpreter.
+
- Bug #532646: The object set to the __call__ attribute has its own __call__
attribute checked; this continues until the attribute can no longer be found
or segfaulting. Recursion limit is now followed.
Modified: python/branches/release24-maint/Objects/classobject.c
==============================================================================
--- python/branches/release24-maint/Objects/classobject.c (original)
+++ python/branches/release24-maint/Objects/classobject.c Tue Jun 13 23:50:24 2006
@@ -1428,10 +1428,13 @@
* argument */
result = generic_binary_op(v1, w, opname);
} else {
+ if (Py_EnterRecursiveCall(" after coercion"))
+ return NULL;
if (swapped)
result = (thisfunc)(w, v1);
else
result = (thisfunc)(v1, w);
+ Py_LeaveRecursiveCall();
}
Py_DECREF(coerced);
return result;
More information about the Python-checkins
mailing list