Commits

Serhiy Storchaka committed c368e43 Merge

Merge heads

  • Participants
  • Parent commits 383d852, 42aecc6

Comments (0)

Files changed (2)

     if (Py_TYPE(v)->tp_repr == NULL)
         return PyUnicode_FromFormat("<%s object at %p>",
                                     v->ob_type->tp_name, v);
-
-#ifdef Py_DEBUG
-    /* PyObject_Repr() must not be called with an exception set,
-       because it may clear it (directly or indirectly) and so the
-       caller looses its exception */
-    assert(!PyErr_Occurred());
-#endif
-
     res = (*v->ob_type->tp_repr)(v);
     if (res == NULL)
         return NULL;
 #endif
     if (v == NULL)
         return PyUnicode_FromString("<NULL>");
-
     if (PyUnicode_CheckExact(v)) {
 #ifndef Py_DEBUG
         if (PyUnicode_READY(v) < 0)
     if (Py_TYPE(v)->tp_str == NULL)
         return PyObject_Repr(v);
 
-#ifdef Py_DEBUG
-    /* PyObject_Str() must not be called with an exception set,
-       because it may clear it (directly or indirectly) and so the
-       caller looses its exception */
-    assert(!PyErr_Occurred());
-#endif
-
     /* It is possible for a type to have a tp_str representation that loops
        infinitely. */
     if (Py_EnterRecursiveCall(" while getting the str of an object"))

Objects/typeobject.c

         return NULL;
     }
 
-#ifdef Py_DEBUG
-    /* type_call() must not be called with an exception set,
-       because it may clear it (directly or indirectly) and so the
-       caller looses its exception */
-    assert(!PyErr_Occurred());
-#endif
-
     obj = type->tp_new(type, args, kwds);
     if (obj != NULL) {
         /* Ugly exception: when the call was type(something),