Skip to content

Commit

Permalink
Python 3.12 backtraces use '~' in addition to '^' when underlining.
Browse files Browse the repository at this point in the history
GitHub issue #374
  • Loading branch information
millert committed May 3, 2024
1 parent 2e6c90c commit 89918ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/python/regress/testhelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ struct TestData data;

/*
* Starting with Python 3.11, backtraces may contain a line with
* '^' characters to bring attention to the important part of the
* line.
* '~' and '^' characters to bring attention to the important part
* of the line.
*/
static void
remove_underline(char *output)
{
char *cp, *ep;

// Remove lines that only consist of '^' and white space.
// Remove lines that only consist of '~', '^' and white space.
cp = output;
ep = output + strlen(output);
for (;;) {
size_t len = strspn(cp, "^ \t");
size_t len = strspn(cp, "~^ \t");
if (len > 0 && cp[len] == '\n') {
/* Prune out lines that are "underlining". */
memmove(cp, cp + len + 1, (size_t)(ep - cp));
Expand Down

0 comments on commit 89918ca

Please sign in to comment.