Skip to content

Commit 56ac7ef

Browse files
committed
Rename to PyUnstable_Object_Dump()
1 parent 70f5433 commit 56ac7ef

File tree

10 files changed

+26
-24
lines changed

10 files changed

+26
-24
lines changed

Doc/c-api/object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Object Protocol
8585
instead of the :func:`repr`.
8686
8787
88-
.. c:function:: void PyObject_Dump(PyObject *op)
88+
.. c:function:: void PyUnstable_Object_Dump(PyObject *op)
8989
9090
Dump an object *op* to ``stderr``. This should only be used for debugging.
9191

Doc/whatsnew/3.15.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -947,13 +947,13 @@ New features
947947

948948
(Contributed by Victor Stinner in :gh:`129813`.)
949949

950-
* Add :c:func:`PyObject_Dump` to dump an object to ``stderr``. Function used
951-
for debugging.
952-
(Contributed by Victor Stinner in :gh:`141070`.)
953-
954950
* Add :c:func:`PyTuple_FromArray` to create a :class:`tuple` from an array.
955951
(Contributed by Victor Stinner in :gh:`111489`.)
956952

953+
* Add :c:func:`PyUnstable_Object_Dump` to dump an object to ``stderr``.
954+
It should only be used for debugging.
955+
(Contributed by Victor Stinner in :gh:`141070`.)
956+
957957

958958
Changed C APIs
959959
--------------

Include/cpython/object.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *);
295295

296296
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
297297
PyAPI_FUNC(void) _Py_BreakPoint(void);
298-
PyAPI_FUNC(void) PyObject_Dump(PyObject *);
298+
PyAPI_FUNC(void) PyUnstable_Object_Dump(PyObject *);
299299

300300
// Alias for backward compatibility
301-
#define _PyObject_Dump PyObject_Dump
301+
#define _PyObject_Dump PyUnstable_Object_Dump
302302

303303
PyAPI_FUNC(PyObject*) _PyObject_GetAttrId(PyObject *, _Py_Identifier *);
304304

@@ -390,10 +390,11 @@ PyAPI_FUNC(PyObject *) _PyObject_FunctionStr(PyObject *);
390390
process with a message on stderr if the given condition fails to hold,
391391
but compile away to nothing if NDEBUG is defined.
392392
393-
However, before aborting, Python will also try to call PyObject_Dump() on
394-
the given object. This may be of use when investigating bugs in which a
395-
particular object is corrupt (e.g. buggy a tp_visit method in an extension
396-
module breaking the garbage collector), to help locate the broken objects.
393+
However, before aborting, Python will also try to call
394+
PyUnstable_Object_Dump() on the given object. This may be of use when
395+
investigating bugs in which a particular object is corrupt (e.g. buggy a
396+
tp_visit method in an extension module breaking the garbage collector), to
397+
help locate the broken objects.
397398
398399
The WITH_MSG variant allows you to supply an additional message that Python
399400
will attempt to print to stderr, after the object dump. */

Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Add :c:func:`PyObject_Dump` to dump an object to ``stderr``. Function used
2-
for debugging. Patch by Victor Stinner.
1+
Add :c:func:`PyUnstable_Object_Dump` to dump an object to ``stderr``. It should
2+
only be used for debugging. Patch by Victor Stinner.

Modules/_testcapi/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,12 @@ pyobject_dump(PyObject *self, PyObject *args)
498498

499499
if (release_gil) {
500500
Py_BEGIN_ALLOW_THREADS
501-
PyObject_Dump(op);
501+
PyUnstable_Object_Dump(op);
502502
Py_END_ALLOW_THREADS
503503

504504
}
505505
else {
506-
PyObject_Dump(op);
506+
PyUnstable_Object_Dump(op);
507507
}
508508
Py_RETURN_NONE;
509509
}

Objects/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ _PyObject_IsFreed(PyObject *op)
713713

714714
/* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */
715715
void
716-
PyObject_Dump(PyObject* op)
716+
PyUnstable_Object_Dump(PyObject* op)
717717
{
718718
if (_PyObject_IsFreed(op)) {
719719
/* It seems like the object memory has been freed:
@@ -3150,7 +3150,7 @@ _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg,
31503150

31513151
/* This might succeed or fail, but we're about to abort, so at least
31523152
try to provide any extra info we can: */
3153-
PyObject_Dump(obj);
3153+
PyUnstable_Object_Dump(obj);
31543154

31553155
fprintf(stderr, "\n");
31563156
fflush(stderr);

Objects/unicodeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@ unicode_check_encoding_errors(const char *encoding, const char *errors)
547547
}
548548

549549
/* Disable checks during Python finalization. For example, it allows to
550-
call PyObject_Dump() during finalization for debugging purpose. */
550+
* call PyUnstable_Object_Dump() during finalization for debugging purpose.
551+
*/
551552
if (_PyInterpreterState_GetFinalizing(interp) != NULL) {
552553
return 0;
553554
}

Python/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2235,7 +2235,7 @@ _PyGC_Fini(PyInterpreterState *interp)
22352235
void
22362236
_PyGC_Dump(PyGC_Head *g)
22372237
{
2238-
PyObject_Dump(FROM_GC(g));
2238+
PyUnstable_Object_Dump(FROM_GC(g));
22392239
}
22402240

22412241

Python/pythonrun.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ _PyErr_Display(PyObject *file, PyObject *unused, PyObject *value, PyObject *tb)
11811181
}
11821182
if (print_exception_recursive(&ctx, value) < 0) {
11831183
PyErr_Clear();
1184-
PyObject_Dump(value);
1184+
PyUnstable_Object_Dump(value);
11851185
fprintf(stderr, "lost sys.stderr\n");
11861186
}
11871187
Py_XDECREF(ctx.seen);
@@ -1199,14 +1199,14 @@ PyErr_Display(PyObject *unused, PyObject *value, PyObject *tb)
11991199
PyObject *file;
12001200
if (PySys_GetOptionalAttr(&_Py_ID(stderr), &file) < 0) {
12011201
PyObject *exc = PyErr_GetRaisedException();
1202-
PyObject_Dump(value);
1202+
PyUnstable_Object_Dump(value);
12031203
fprintf(stderr, "lost sys.stderr\n");
1204-
PyObject_Dump(exc);
1204+
PyUnstable_Object_Dump(exc);
12051205
Py_DECREF(exc);
12061206
return;
12071207
}
12081208
if (file == NULL) {
1209-
PyObject_Dump(value);
1209+
PyUnstable_Object_Dump(value);
12101210
fprintf(stderr, "lost sys.stderr\n");
12111211
return;
12121212
}

0 commit comments

Comments
 (0)