summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 3289aba..0588fea 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -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) {