mirror of https://github.com/python/cpython
If USE_STACKCHECK is defined use PyOS_CheckStack() in the repr and str
routines. This catches a slightly different set of crashes than the recursive-repr fix. (Jack)
This commit is contained in:
parent
f2044e1a71
commit
9b00dfae75
|
@ -162,6 +162,12 @@ PyObject_Print(op, fp, flags)
|
|||
int ret = 0;
|
||||
if (PyErr_CheckSignals())
|
||||
return -1;
|
||||
#ifdef USE_STACKCHECK
|
||||
if (PyOS_CheckStack()) {
|
||||
PyErr_SetString(PyExc_MemoryError, "Stack overflow");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if (op == NULL) {
|
||||
fprintf(fp, "<nil>");
|
||||
}
|
||||
|
@ -213,6 +219,12 @@ PyObject_Repr(v)
|
|||
{
|
||||
if (PyErr_CheckSignals())
|
||||
return NULL;
|
||||
#ifdef USE_STACKCHECK
|
||||
if (PyOS_CheckStack()) {
|
||||
PyErr_SetString(PyExc_MemoryError, "Stack overflow");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
if (v == NULL)
|
||||
return PyString_FromString("<NULL>");
|
||||
else if (v->ob_type->tp_repr == NULL) {
|
||||
|
|
Loading…
Reference in New Issue