diff --git a/bindings/python/tree_sitter_tree_sitter_vb_dotnet/binding.c b/bindings/python/tree_sitter_tree_sitter_vb_dotnet/binding.c index 8122c88..3bf1829 100644 --- a/bindings/python/tree_sitter_tree_sitter_vb_dotnet/binding.c +++ b/bindings/python/tree_sitter_tree_sitter_vb_dotnet/binding.c @@ -2,10 +2,15 @@ typedef struct TSLanguage TSLanguage; -TSLanguage *tree_sitter_tree_sitter_vb_dotnet(void); +TSLanguage *tree_sitter_vb_dotnet(void); static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) { - return PyCapsule_New(tree_sitter_tree_sitter_vb_dotnet(), "tree_sitter.Language", NULL); + TSLanguage *language = tree_sitter_vb_dotnet(); + if (language == NULL) { + PyErr_SetString(PyExc_RuntimeError, "Failed to load VB.NET language grammar"); + return NULL; + } + return PyCapsule_New(language, "tree_sitter.Language", NULL); } static struct PyModuleDef_Slot slots[] = {