What's wrong ?
When you use the tree-sitter grammar with python, the current binding.c uses a depracated constructor:
Language(ptr) is deprecated since tree-sitter 0.22.0
Expected :
The library moved to a new architecture where you should use language specific packages.
Solution :
For the batch-tamarin project, to use a parser, I needed to precompile the grammar for each platforms and architecture, I replaced the deprecated function by the current way to do it :
src/grammar/tree-sitter-tamarin/bindings/python/tree_sitter_spthy/binding.c, at line 8
return PyLong_FromVoidPtr(tree_sitter_spthy());
should be replaced by :
return PyCapsule_New(tree_sitter_spthy(), "tree_sitter.Language", NULL);
and the src/grammar/tree-sitter-tamarin/bindings/python/tree_sitter_spthy/init.py should be rewritten as :
"Spthy grammar for tree-sitter"
from tree_sitter import Language
from ._binding import language as _language
def language():
"""Get the tree-sitter language for Spthy."""
return Language(_language())
__all__ = ["language"]
This will completely fix the deprecated warning. At least, it worked for my package
What's wrong ?
When you use the tree-sitter grammar with python, the current binding.c uses a depracated constructor:
Language(ptr) is deprecated since tree-sitter 0.22.0
Expected :
The library moved to a new architecture where you should use language specific packages.
Solution :
For the batch-tamarin project, to use a parser, I needed to precompile the grammar for each platforms and architecture, I replaced the deprecated function by the current way to do it :
src/grammar/tree-sitter-tamarin/bindings/python/tree_sitter_spthy/binding.c, at line 8
should be replaced by :
and the src/grammar/tree-sitter-tamarin/bindings/python/tree_sitter_spthy/init.py should be rewritten as :
This will completely fix the deprecated warning. At least, it worked for my package