diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index 262a72f7c2501c5eb94ce75ea90a09f9e83d5776_c2ltcGxlanNvbi9fc3BlZWR1cHMuYw==..cb156a4049ab6cd4d404834ae0af9fdba0169e80_c2ltcGxlanNvbi9fc3BlZWR1cHMuYw== 100644
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -2146,7 +2146,8 @@
 {
     /* Encode Python object obj to a JSON term, rval is a PyList */
     int rv = -1;
-
+    if (Py_EnterRecursiveCall(" while encoding a JSON document"))
+        return rv;
     do {
         if (obj == Py_None || obj == Py_True || obj == Py_False) {
             PyObject *cstr = _encoded_const(obj);