summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-09-18 12:10:16 (GMT)
committerGitHub <noreply@github.com>2019-09-18 12:10:16 (GMT)
commit47bbab9f76735acc1991e541d12fd18be6b13b16 (patch)
treededa23c37efb7ae3a1d084cd4b4388e773e450d1 /Objects
parent7a2f68776a77c782c0abf40dc9e3fb687787e730 (diff)
downloadcpython-47bbab9f76735acc1991e541d12fd18be6b13b16.zip
cpython-47bbab9f76735acc1991e541d12fd18be6b13b16.tar.gz
cpython-47bbab9f76735acc1991e541d12fd18be6b13b16.tar.bz2
[3.8] bpo-38070: Py_FatalError() logs runtime state (GH-16258)
* bpo-38070: _Py_DumpTraceback() writes <no Python frame> (GH-16244) When a Python thread has no frame, _Py_DumpTraceback() and _Py_DumpTracebackThreads() now write "<no Python frame>", rather than writing nothing. (cherry picked from commit 8fa3e1740b3f03ea65ddb68411c2238c5f98eec2) * bpo-38070: Enhance _PyObject_Dump() (GH-16243) _PyObject_Dump() now dumps the object address for freed objects and objects with ob_type=NULL. (cherry picked from commit b39afb78768418d9405c4b528c80fa968ccc974d) * bpo-38070: Add _PyRuntimeState.preinitializing (GH-16245) Add _PyRuntimeState.preinitializing field: set to 1 while Py_PreInitialize() is running. _PyRuntimeState: rename also pre_initialized field to preinitialized. (cherry picked from commit d3b904144e86e2442961de6a7dccecbe133d5c6d) * bpo-38070: Py_FatalError() logs runtime state (GH-16246) (cherry picked from commit 1ce16fb0977283ae42a9f8917bbca5f44aa69324)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 585a974..df25313 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -464,7 +464,7 @@ void
_PyObject_Dump(PyObject* op)
{
if (op == NULL) {
- fprintf(stderr, "<NULL object>\n");
+ fprintf(stderr, "<object at NULL>\n");
fflush(stderr);
return;
}
@@ -472,7 +472,7 @@ _PyObject_Dump(PyObject* op)
if (_PyObject_IsFreed(op)) {
/* It seems like the object memory has been freed:
don't access it to prevent a segmentation fault. */
- fprintf(stderr, "<Freed object>\n");
+ fprintf(stderr, "<object at %p is freed>\n", op);
return;
}
@@ -2162,18 +2162,19 @@ _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg,
fflush(stderr);
if (obj == NULL) {
- fprintf(stderr, "<NULL object>\n");
+ fprintf(stderr, "<object at NULL>\n");
}
else if (_PyObject_IsFreed(obj)) {
/* It seems like the object memory has been freed:
don't access it to prevent a segmentation fault. */
- fprintf(stderr, "<object: freed>\n");
+ fprintf(stderr, "<object at %p is freed>\n", obj);
}
else if (Py_TYPE(obj) == NULL) {
- fprintf(stderr, "<object: ob_type=NULL>\n");
+ fprintf(stderr, "<object at %p: ob_type=NULL>\n", obj);
}
else if (_PyObject_IsFreed((PyObject *)Py_TYPE(obj))) {
- fprintf(stderr, "<object: freed type %p>\n", (void *)Py_TYPE(obj));
+ fprintf(stderr, "<object at %p: type at %p is freed>\n",
+ obj, (void *)Py_TYPE(obj));
}
else {
/* Display the traceback where the object has been allocated.