-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
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
Changes from 6 commits
2d55425
8abec04
4338ac0
2e982a1
e4c7cdc
c65db8f
94b9315
423d25a
f64a812
bf279d3
70f5433
56ac7ef
b98c9b2
376a186
File filter
Filter by extension
Conversations
Jump to
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.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add :c:func:`PyObject_Dump` to dump an object to ``stderr``. Function 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) | ||
| PyObject_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
Member
Author
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
Member
Author
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); | ||
| PyObject_Dump(obj); | ||
|
|
||
| fprintf(stderr, "\n"); | ||
| fflush(stderr); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.