py-tree-sitter icon indicating copy to clipboard operation
py-tree-sitter copied to clipboard

Release Python GIL when possible

Open grantjenks opened this issue 3 years ago • 6 comments

I'm looking to search several million source files using the tree-sitter query interface. I'd love to use a thread pool in Python for this. Would it be possible to make a thread-safe Query.captures method that released the GIL?

I tried doing it in https://github.com/grantjenks/py-tree-sitter-languages but couldn't figure it out this evening (not sure it's possible with the current interface).

grantjenks avatar May 23 '22 05:05 grantjenks

PR welcome.

ObserverOfTime avatar Feb 26 '24 10:02 ObserverOfTime

This might be slightly easier to implement with recent changes to GIL in 3.12: https://docs.python.org/3.12/whatsnew/3.12.html#pep-684-a-per-interpreter-gil

ansipunk avatar Feb 28 '24 06:02 ansipunk