Skip to content

Commit

Permalink
binding/query.c: use PyErr_Format instead of _PyErr_FormatFromCause
Browse files Browse the repository at this point in the history
The `_PyErr_FormatFromCause` function is a private function, which was
never documented. While it existed for a long time, it was removed in
Python 3.13 [1].

Use instead the public function `PyErr_Format`, which is also part of
the stable API.

[1] python/cpython#106320

Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
  • Loading branch information
arthurzam committed Aug 28, 2024
1 parent 876fd40 commit 931d868
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tree_sitter/binding/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ PyObject *query_new(PyTypeObject *cls, PyObject *args, PyObject *Py_UNUSED(kwarg
PyObject *pattern =
PyObject_CallFunction(state->re_compile, "s#", second_arg, length);
if (pattern == NULL) {
_PyErr_FormatFromCause(
PyErr_Format(
state->query_error,
"Invalid predicate in pattern at row %u: regular expression error", row);
goto error;
Expand Down

0 comments on commit 931d868

Please sign in to comment.