Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-141070: Add PyUnstable_Object_Dump() function#141072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
2d554258abec044338ac02e982a1e4c7cdcc65db8f94b9315423d25af64a812bf279d370f543356ac7efb98c9b2376a186File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add :c:func:`PyUnstable_Object_Dump` to dump an object to ``stderr``. It should | ||
| only be used for debugging. Patch by Victor Stinner. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -713,7 +713,7 @@ _PyObject_IsFreed(PyObject *op) | ||
| /* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */ | ||
| void | ||
| _PyObject_Dump(PyObject* op) | ||
| PyUnstable_Object_Dump(PyObject* op) | ||
| { | ||
| if (_PyObject_IsFreed(op)) { | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a special case for And for MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It displays How do you suggest to format op==NULL and/or type==NULL? Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is already tested, then good. I was not sure that If type==NULL (very unlikely), then type->tp_name and repr() will crash. They will also crash if type was freed or if it is just a garbage. We could skip prints in that case avoid crash, although it may be too late. Looking at the code, it seems the ideas I had (testing against the patterns used to fill the freed memory) was already implemented in MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
| ||
| /* It seems like the object memory has been freed: | ||
| @@ -3150,7 +3150,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: */ | ||
| _PyObject_Dump(obj); | ||
| PyUnstable_Object_Dump(obj); | ||
| fprintf(stderr, "\n"); | ||
| fflush(stderr); | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entries should be sorted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that. What's the sort key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Sorted alphabetically". @hugovk added comments like that in the What's New document:
.. Add C API deprecations above alphabetically, not here at the end.We should add a similar comment for C API "New features". I think that it was @AA-Turner who started to sort items in What's New In Python 3.14.