You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add PyUnstable_Object_Dump() function: promote private _PyObject_Dump() to a public function #87
I'd prefer either PyUnstable_Object_Dump (purity -- debug helpers should be unstable) or Py_Dump (practicality -- short to type in gdb). I don't think the compromise solves much.
But I'll yield to the majority.
BTW, I recently searched bugs in set, and needed to output the dump of the set, including empty and dummy entries. I initially tried to use PyUnstable_Object_Dump(), but it was not so helpful when output several dumps one after other. More compact format with indentation would be more convenient. But this was a special one-time case. I ended with using simple fprintf(). If make PyObject_Dump() more configurable, it will be less convenient in cases where it is currently used.
Activity
vstinner commentedon Nov 12, 2025
Ping @serhiy-storchaka
vstinner commentedon Nov 17, 2025
Ping @serhiy-storchaka
vstinner commentedon Nov 18, 2025
Ok, the C API Working Group approved this API. Thanks you all!
serhiy-storchaka commentedon Nov 18, 2025
Is there a need to add a parameter for the output stream or file descriptor?
vstinner commentedon Nov 18, 2025
I don't think so. I prefer to hardcode stderr, since stderr is used for debugging. It simplify the code.
In practice, the code writes to the C
stderrstream and to the Pythonsys.stderrobject.vstinner commentedon Nov 18, 2025
Sorry, I just checked the code, it's only the C
stderrstream.encukou commentedon Dec 16, 2025
Reopening to make this fully public -- see the Discourse thread.
Expose this as
PyObject_Dumprather thanPyUnstable_Object_Dump.I'll abstain.
erlend-aasland commentedon Dec 16, 2025
Why do you abstain? From your latest comment over at DPO, it appears you are approving.
encukou commentedon Dec 16, 2025
I'd prefer either
PyUnstable_Object_Dump(purity -- debug helpers should be unstable) orPy_Dump(practicality -- short to type ingdb). I don't think the compromise solves much.But I'll yield to the majority.
davidhewitt commentedon Dec 16, 2025
What about
PyUnstable_Dump?vstinner commentedon Jan 8, 2026
Ping @serhiy-storchaka @zooba.
zooba commentedon Jan 12, 2026
+1 to
PyObject_Dumpencukou commentedon Jan 15, 2026
Ping @serhiy-storchaka
serhiy-storchaka commentedon Jan 15, 2026
Sorry, I though I already voted for this.
BTW, I recently searched bugs in
set, and needed to output the dump of the set, including empty and dummy entries. I initially tried to usePyUnstable_Object_Dump(), but it was not so helpful when output several dumps one after other. More compact format with indentation would be more convenient. But this was a special one-time case. I ended with using simplefprintf(). If makePyObject_Dump()more configurable, it will be less convenient in cases where it is currently used.vstinner commentedon Jan 16, 2026
The C API Working approved renaming the function to PyObject_Dump(). I close the issue. See PR python/cpython#142848 to rename the function.