Skip to content

Commit

Permalink
backtraces are not available on musl
Browse files Browse the repository at this point in the history
  • Loading branch information
culler committed Sep 13, 2024
1 parent 7c9966c commit 29b754a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cypari/implementation.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ Interrupt and signal handling for Cython
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#if (defined(__APPLE__) || defined(__UCLIBC__) || defined(__GLIBC__)) /* Not musl. */
#include <execinfo.h>
#else
#define NO_BACKTRACE 1
#endif
#include <execinfo.h>
#include <Python.h>
#include <pari/pari.h>
Expand Down Expand Up @@ -282,11 +287,13 @@ static void print_sep(void)
/* Print a backtrace if supported by libc */
static void print_backtrace()
{
#if !defined(NO_BACKTRACE)
void* backtracebuffer[1024];
fflush(stderr);
int btsize = backtrace(backtracebuffer, 1024);
backtrace_symbols_fd(backtracebuffer, btsize, 2);
print_sep();
#endif
}

/* Print a message s and kill ourselves with signal sig */
Expand Down

0 comments on commit 29b754a

Please sign in to comment.