diff options
Diffstat (limited to 'Modules/_collectionsmodule.c')
| -rw-r--r-- | Modules/_collectionsmodule.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 05b03b7..67700de 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -1300,7 +1300,17 @@ defdict_repr(defdictobject *dd) if (dd->default_factory == NULL) defrepr = PyString_FromString("None"); else - defrepr = PyObject_Repr(dd->default_factory); + { + int status = Py_ReprEnter(dd->default_factory); + if (status != 0) { + if (status < 0) + return NULL; + defrepr = PyString_FromString("..."); + } + else + defrepr = PyObject_Repr(dd->default_factory); + Py_ReprLeave(dd->default_factory); + } if (defrepr == NULL) { Py_DECREF(baserepr); return NULL; |
