Skip to content

Commit

Permalink
fix(parser): handle callback errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed May 19, 2024
1 parent 2c0a6ee commit aedac3a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tree_sitter/binding/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,11 @@ PyObject *parser_parse(Parser *self, PyObject *args, PyObject *kwargs) {
return NULL;
}

if (PyErr_Occurred()) {
return NULL;
}
if (!new_tree) {
if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ValueError, "Parsing failed");
}
PyErr_SetString(PyExc_ValueError, "Parsing failed");
return NULL;
}

Expand Down

0 comments on commit aedac3a

Please sign in to comment.