Skip to content

Commit

Permalink
feat: add language version constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Mar 15, 2024
1 parent ea468a3 commit 259e8c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ concurrency:
jobs:
build_asan:
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: true
env:
PYTHON_VERSION: "3.10"
PYTHON_VERSION: "3.11"
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -45,6 +47,7 @@ jobs:
--with-assertions \
--with-address-sanitizer \
--with-undefined-behavior-sanitizer \
--disable-test-modules \
--disable-shared \
--prefix="$PYTHON_PATH"
make && make install
Expand Down
4 changes: 4 additions & 0 deletions tree_sitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
Range,
Tree,
TreeCursor,
LANGUAGE_VERSION,
MIN_COMPATIBLE_LANGUAGE_VERSION,
)

__all__ = [
Expand All @@ -24,4 +26,6 @@
"Range",
"Tree",
"TreeCursor",
"LANGUAGE_VERSION",
"MIN_COMPATIBLE_LANGUAGE_VERSION",
]
4 changes: 4 additions & 0 deletions tree_sitter/binding/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ PyMODINIT_FUNC PyInit__binding(void) {
goto cleanup;
}

PyModule_AddIntConstant(module, "LANGUAGE_VERSION", TREE_SITTER_LANGUAGE_VERSION);
PyModule_AddIntConstant(module, "MIN_COMPATIBLE_LANGUAGE_VERSION",
TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION);

return module;

cleanup:
Expand Down

0 comments on commit 259e8c9

Please sign in to comment.