instead of the :func:`repr`.
-.. c:function:: void PyUnstable_Object_Dump(PyObject *op)
+.. c:function:: void PyObject_Dump(PyObject *op)
Dump an object *op* to ``stderr``. This should only be used for debugging.
* Add :c:func:`PyTuple_FromArray` to create a :class:`tuple` from an array.
(Contributed by Victor Stinner in :gh:`111489`.)
-* Add :c:func:`PyUnstable_Object_Dump` to dump an object to ``stderr``.
+* Add :c:func:`PyObject_Dump` to dump an object to ``stderr``.
It should only be used for debugging.
(Contributed by Victor Stinner in :gh:`141070`.)
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
PyAPI_FUNC(void) _Py_BreakPoint(void);
-PyAPI_FUNC(void) PyUnstable_Object_Dump(PyObject *);
+PyAPI_FUNC(void) PyObject_Dump(PyObject *);
// Alias for backward compatibility
-#define _PyObject_Dump PyUnstable_Object_Dump
+#define _PyObject_Dump PyObject_Dump
Py_DEPRECATED(3.15) PyAPI_FUNC(PyObject*) _PyObject_GetAttrId(PyObject *, _Py_Identifier *);
but compile away to nothing if NDEBUG is defined.
However, before aborting, Python will also try to call
- PyUnstable_Object_Dump() on the given object. This may be of use when
+ PyObject_Dump() on the given object. This may be of use when
investigating bugs in which a particular object is corrupt (e.g. buggy a
tp_visit method in an extension module breaking the garbage collector), to
help locate the broken objects.
_PyStaticObject_CheckRefcnt(PyObject *obj) {
if (!_Py_IsImmortal(obj)) {
fprintf(stderr, "Immortal Object has less refcnt than expected.\n");
- PyUnstable_Object_Dump(obj);
+ PyObject_Dump(obj);
}
}
#endif
.. nonce: mkrhjQ
.. section: C API
-Add :c:func:`PyUnstable_Object_Dump` to dump an object to ``stderr``. It
+Add :c:func:`!PyUnstable_Object_Dump` to dump an object to ``stderr``. It
should only be used for debugging. Patch by Victor Stinner.
..
--- /dev/null
+Renamed :c:func:`!PyUnstable_Object_Dump` to :c:func:`PyObject_Dump`.
if (release_gil) {
Py_BEGIN_ALLOW_THREADS
- PyUnstable_Object_Dump(op);
+ PyObject_Dump(op);
Py_END_ALLOW_THREADS
}
else {
- PyUnstable_Object_Dump(op);
+ PyObject_Dump(op);
}
Py_RETURN_NONE;
}
/* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */
void
-PyUnstable_Object_Dump(PyObject* op)
+PyObject_Dump(PyObject* op)
{
if (_PyObject_IsFreed(op)) {
/* It seems like the object memory has been freed:
/* This might succeed or fail, but we're about to abort, so at least
try to provide any extra info we can: */
- PyUnstable_Object_Dump(obj);
+ PyObject_Dump(obj);
fprintf(stderr, "\n");
fflush(stderr);
}
/* Disable checks during Python finalization. For example, it allows to
- * call PyUnstable_Object_Dump() during finalization for debugging purpose.
+ * call PyObject_Dump() during finalization for debugging purpose.
*/
if (_PyInterpreterState_GetFinalizing(interp) != NULL) {
return 0;
void
_PyGC_Dump(PyGC_Head *g)
{
- PyUnstable_Object_Dump(FROM_GC(g));
+ PyObject_Dump(FROM_GC(g));
}
}
if (print_exception_recursive(&ctx, value) < 0) {
PyErr_Clear();
- PyUnstable_Object_Dump(value);
+ PyObject_Dump(value);
fprintf(stderr, "lost sys.stderr\n");
}
Py_XDECREF(ctx.seen);
PyObject *file;
if (PySys_GetOptionalAttr(&_Py_ID(stderr), &file) < 0) {
PyObject *exc = PyErr_GetRaisedException();
- PyUnstable_Object_Dump(value);
+ PyObject_Dump(value);
fprintf(stderr, "lost sys.stderr\n");
- PyUnstable_Object_Dump(exc);
+ PyObject_Dump(exc);
Py_DECREF(exc);
return;
}
if (file == NULL) {
- PyUnstable_Object_Dump(value);
+ PyObject_Dump(value);
fprintf(stderr, "lost sys.stderr\n");
return;
}