8000 Apply suggestions from code review · python/cpython@524f167 · GitHub
[go: up one dir, main page]

Skip to content

Commit 524f167

Browse files
Apply suggestions from code review
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
1 parent ec832aa commit 524f167

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Modules/faulthandler.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,16 @@ faulthandler_dump_traceback(int fd, int all_threads,
220220
static void
221221
faulthandler_stack_dump_impl(int fd)
222222
{
223-
#define SIZE 128
224-
#define ENTRY_SIZE 256
223+
#define BACKTRACE_SIZE 128
224+
#define TRACEBACK_ENTRY_MAX_SIZE 256
225225
void *callstack[SIZE];
226226
int frames = backtrace(callstack, SIZE);
227227
char **strings = backtrace_symbols(callstack, SIZE);
228-
if (strings == NULL)
229-
{
228+
if (strings == NULL) {
230229
PUTS(fd, " <failed to get stack trace>");
231230
}
232231
else {
233-
for (int i = 0; i < frames; ++i)
234-
{
232+
for (int i = 0; i < frames; ++i) {
235233
char entry_str[ENTRY_SIZE];
236234
snprintf(entry_str, ENTRY_SIZE, " %s\n", strings[i]);
237235
size_t length = strlen(entry_str) + 1;
@@ -249,8 +247,7 @@ faulthandler_stack_dump_impl(int fd)
249247
_Py_write_noraise(fd, entry_str, length);
250248
}
251249

252-
if (frames == SIZE)
253-
{
250+
if (frames == SIZE) {
254251
PUTS(fd, " <truncated rest of calls>");
255252
}
256253
}
@@ -282,8 +279,7 @@ faulthandler_dump_c_stack(int fd)
282279

283280
reentrant = 1;
284281

285-
if (fatal_error.c_stack)
286-
{
282+
if (fatal_error.c_stack) {
287283
PUTS(fd, "\n");
288284
faulthandler_dump_c_stack_nocheck(fd);
289285
}

0 commit comments

Comments
 (0)
0