Skip to content

Commit e9c3d7c

Browse files
committed
Use faulthandler formatting.
1 parent 7a070ab commit e9c3d7c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/test/test_faulthandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def temporary_filename():
5959
ADDRESS_EXPR = "0x[0-9a-f]+"
6060
C_STACK_REGEX = [
6161
r"Current thread's C stack trace \(most recent call first\):",
62-
fr" ((\/.+)+\(.*\+{ADDRESS_EXPR}\) \[{ADDRESS_EXPR}\])|(<.+>)"
62+
fr'( Binary file ".+"(, at .*(\+|-){ADDRESS_EXPR})? \[{ADDRESS_EXPR}\])|(<.+>)'
6363
]
6464

6565
class FaultHandlerTests(unittest.TestCase):

Python/traceback.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ _Py_backtrace_symbols_fd(int fd, void *const *array, Py_ssize_t size)
11991199
|| info[i].dli_fname == NULL
12001200
|| info[i].dli_fname[0] == '\0'
12011201
) {
1202-
dprintf(fd, " [%p]\n", array[i]);
1202+
dprintf(fd, " Binary file '<unknown>' [%p]\n", array[i]);
12031203
continue;
12041204
}
12051205

@@ -1211,7 +1211,7 @@ _Py_backtrace_symbols_fd(int fd, void *const *array, Py_ssize_t size)
12111211

12121212
if (info[i].dli_sname == NULL
12131213
&& info[i].dli_saddr == 0) {
1214-
dprintf(fd, " %s(%s) [%p]\n",
1214+
dprintf(fd, " Binary file \"%s\", at %s [%p]\n",
12151215
info[i].dli_fname ?: "",
12161216
info[i].dli_sname ?: "",
12171217
array[i]);
@@ -1227,7 +1227,7 @@ _Py_backtrace_symbols_fd(int fd, void *const *array, Py_ssize_t size)
12271227
sign = '-';
12281228
offset = info[i].dli_saddr - array[i];
12291229
}
1230-
dprintf(fd, " %s(%s%c%#tx) [%p]\n",
1230+
dprintf(fd, " Binary file \"%s\", at %s%c%#tx [%p]\n",
12311231
info[i].dli_fname ?: "",
12321232
info[i].dli_sname ?: "",
12331233
sign, offset, array[i]);

0 commit comments

Comments
 (0)