]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-141070: Rename `PyUnstable_Object_Dump` to `PyObject_Dump` (GH-142848)
authorPeter Bierma <zintensitydev@gmail.com>
Fri, 16 Jan 2026 14:19:43 +0000 (09:19 -0500)
committerGitHub <noreply@github.com>
Fri, 16 Jan 2026 14:19:43 +0000 (09:19 -0500)
Doc/c-api/object.rst
Doc/whatsnew/3.15.rst
Include/cpython/object.h
Include/internal/pycore_global_objects_fini_generated.h
Misc/NEWS.d/3.15.0a3.rst
Misc/NEWS.d/next/C_API/2025-12-16-18-39-30.gh-issue-141070.4EKDZ1.rst [new file with mode: 0644]
Modules/_testcapi/object.c
Objects/object.c
Objects/unicodeobject.c
Python/gc.c
Python/pythonrun.c

index 3e0cc660317ba9e07e60cdd3846f055949117f8a..127b50ac47963897319069e8b7b22ce19fca7ac5 100644 (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.
 
index 57c9bc255b2a9a0f66fda1e21dd518dab4674c0d..b7a27d5db638755ba8c1343b8519a5b8b39c3604 100644 (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`.)
 
index 85d5edd62e3a72e0239ff968c9018e7ad720bd87..28c909531dba64bbe3bb2f60ff897d9cdf1ab81f 100644 (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.
index 705721021e9f49f83f65837117031e65e9434e65..4a5b2a925413bfe0b7cd89184b9cb0bc58d1c316 100644 (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
index e493c3570847fdd893c9355326946346f71a1ddb..8f4200cec1d61adc75a9bb3cdd01c0065dd47a6d 100644 (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.
 
 ..
diff --git a/Misc/NEWS.d/next/C_API/2025-12-16-18-39-30.gh-issue-141070.4EKDZ1.rst b/Misc/NEWS.d/next/C_API/2025-12-16-18-39-30.gh-issue-141070.4EKDZ1.rst
new file mode 100644 (file)
index 0000000..09ccd12
--- /dev/null
@@ -0,0 +1 @@
+Renamed :c:func:`!PyUnstable_Object_Dump` to :c:func:`PyObject_Dump`.
index a4f76c409c6f78bd5613a63792c9125262f6ee3c..153b28e5fe2e959b3d647aac3337e5dde510b379 100644 (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;
 }
index 4fc692bb02940e4bafb2812f81bfafb8d8d8416b..ea42990e69b929c34428ee812cf82b7274b74684 100644 (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);
index f737a885f197a02ed92cc6920f641457cd5e3e38..fdcbcf51cb62c2d39a51cd4855bf578918bd5f1f 100644 (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;
index d067a6144b0763267e29097ddbd5ab86e3388e90..2f373dcb402df3490719c5a7cd7863a85771e447 100644 (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));
 }
 
 
index f2c402eb1a03b58e88bdcf805e0db79678e013ed..ec8c2d12ab27fcb5fb2a5dfbeb834dac0e2ad05d 100644 (file)
@@ -1175,7 +1175,7 @@ fallback:
     }
     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;
     }