| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
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:`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 |
|---|---|---|
| Expand Up | @@ -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)) { | ||
|
Comment thread
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityMaybe add a special case for op == NULL? And for type == NULL?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIt displays freed in both cases. There is now an unit test for that. How do you suggest to format op==NULL and/or type==NULL?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIf this is already tested, then good. I was not sure that _PyObject_IsFreed() works with NULL (it could crash). 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 _PyMem_IsPtrFreed().
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
_PyObject_IsFreed() checks _PyMem_IsPtrFreed(Py_TYPE(op)). We just display freed in this case, without displaying tp_name or trying to call repr().
Sorry, something went wrong.
All reactions
|
||
| /* It seems like the object memory has been freed: | ||
| Expand Down Expand Up | @@ -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); | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityEntries should be sorted.
Sorry, something went wrong.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI didn't know that. What's the sort key?
Sorry, something went wrong.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality"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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.