gh-141070: Rename PyUnstable_Object_Dump to PyObject_Dump (GH-142848)

This commit is contained in:
Peter Bierma 2026-01-16 09:19:43 -05:00 committed by GitHub
parent 780e9692fe
commit 19e64afddf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 18 additions and 17 deletions

View file

@ -85,7 +85,7 @@ Object Protocol
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.

View file

@ -1261,7 +1261,7 @@ New features
* 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`.)

View file

@ -295,10 +295,10 @@ PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *);
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 *);
@ -391,7 +391,7 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *);
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.

View file

@ -13,7 +13,7 @@ static inline void
_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

View file

@ -1452,7 +1452,7 @@ sqlite when used with multiple sub interpreters.
.. 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.
..

View file

@ -0,0 +1 @@
Renamed :c:func:`!PyUnstable_Object_Dump` to :c:func:`PyObject_Dump`.

View file

@ -507,12 +507,12 @@ pyobject_dump(PyObject *self, PyObject *args)
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;
}

View file

@ -713,7 +713,7 @@ _PyObject_IsFreed(PyObject *op)
/* 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:
@ -3157,7 +3157,7 @@ _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg,
/* 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);

View file

@ -547,7 +547,7 @@ unicode_check_encoding_errors(const char *encoding, const char *errors)
}
/* 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;

View file

@ -2243,7 +2243,7 @@ _PyGC_Fini(PyInterpreterState *interp)
void
_PyGC_Dump(PyGC_Head *g)
{
PyUnstable_Object_Dump(FROM_GC(g));
PyObject_Dump(FROM_GC(g));
}

View file

@ -1175,7 +1175,7 @@ _PyErr_Display(PyObject *file, PyObject *unused, PyObject *value, PyObject *tb)
}
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);
@ -1193,14 +1193,14 @@ PyErr_Display(PyObject *unused, PyObject *value, PyObject *tb)
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;
}