Skip to content

Commit d64c3b7

Browse files
authored
just strip out the ascii formatting first (#16494)
Co-authored-by: amunger <>
1 parent af1aaf5 commit d64c3b7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/kernels/execution/helpers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,13 @@ export async function endCellAndDisplayErrorsInCell(
779779
}
780780

781781
export function findErrorLocation(traceback: string[], cell: NotebookCell) {
782-
const cellRegex = /Cell\s+(?:\u001b\[.+?m)?In\s*\[(?<executionCount>\d+)\],\s*line (?<lineNumber>\d+).*/;
782+
const cellRegex = /Cell\s+In\s*\[(?<executionCount>\d+)\],\s*line (?<lineNumber>\d+).*/;
783783
// older versions of IPython ~8.3.0
784-
const inputRegex =
785-
/Input\s+?(?:\u001b\[.+?m)?In\s*\[(?<executionCount>\d+)\][^<]*<cell line:\s?(?<lineNumber>\d+)>.*/;
784+
const inputRegex = /Input\s+?In\s*\[(?<executionCount>\d+)\][^<]*<cell line:\s?(?<lineNumber>\d+)>.*/;
786785
let lineNumber: number | undefined = undefined;
787786
for (const line of traceback) {
788-
const lineMatch = cellRegex.exec(line) ?? inputRegex.exec(line);
787+
const cleanLine = line.replace(/(?:\u001b\[.+?m)/g, '');
788+
const lineMatch = cellRegex.exec(cleanLine) ?? inputRegex.exec(cleanLine);
789789
if (lineMatch && lineMatch.groups) {
790790
lineNumber = parseInt(lineMatch.groups['lineNumber']);
791791
break;

0 commit comments

Comments
 (0)