[Python-checkins] CVS: python/dist/src/Objects object.c,2.96,2.97
Jack Jansen
python-dev@python.org
Tue, 22 Aug 2000 14:52:54 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv8039
Modified Files:
object.c
Log Message:
Added PyOS_CheckStack call to PyObject_Compare
Lowered the recursion limit on compares to 60 (one recursion depth can
take a whopping 2K of stack space when running test_b1!)
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.96
retrieving revision 2.97
diff -C2 -r2.96 -r2.97
*** object.c 2000/08/18 05:01:19 2.96
--- object.c 2000/08/22 21:52:51 2.97
***************
*** 12,15 ****
--- 12,18 ----
#include "Python.h"
+ #ifdef HAVE_LIMITS_H
+ #include <limits.h>
+ #endif
#ifdef macintosh
***************
*** 340,344 ****
--- 343,351 ----
nesting limit, enable code to detect circular data structures.
*/
+ #ifdef macintosh
+ #define NESTING_LIMIT 60
+ #else
#define NESTING_LIMIT 500
+ #endif
int _PyCompareState_nesting = 0;
***************
*** 395,398 ****
--- 402,411 ----
int result;
+ #if defined(USE_STACKCHECK)
+ if (PyOS_CheckStack() < 0) {
+ PyErr_SetString(PyExc_MemoryError, "Stack overflow");
+ return -1;
+ }
+ #endif
if (v == NULL || w == NULL) {
PyErr_BadInternalCall();