Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,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`.)

Expand Down
6 changes: 3 additions & 3 deletions Include/cpython/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_global_objects_fini_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Misc/NEWS.d/3.15.0a3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,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.

..
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Renamed :c:func:`!PyUnstable_Object_Dump` to :c:func:`PyObject_Dump`.
4 changes: 2 additions & 2 deletions Modules/_testcapi/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Python/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}


Expand Down
8 changes: 4 additions & 4 deletions Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
Loading