diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d8f784..4ea2f59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: build_asan: runs-on: ubuntu-latest env: - PYTHON_VERSION: "3.8" + PYTHON_VERSION: "3.12" steps: - name: Checkout repository uses: actions/checkout@v4 @@ -60,7 +60,7 @@ jobs: strategy: fail-fast: false matrix: - python: ["3.8", "3.9", "3.10", "3.11"] + python: ["3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, macos-13, windows-latest] runs-on: ${{matrix.os}} steps: diff --git a/pyproject.toml b/pyproject.toml index 4994637..e2cfa21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ "Topic :: Text Processing :: Linguistic", "Typing :: Typed", ] -requires-python = ">=3.8,<3.12" +requires-python = ">=3.9" readme = "README.md" [project.urls] @@ -29,7 +29,7 @@ name = "Max Brunsfeld" email = "maxbrunsfeld@gmail.com" [tool.ruff] -target-version = "py38" +target-version = "py39" line-length = 100 indent-width = 4 extend-exclude = [ diff --git a/tree_sitter/binding.c b/tree_sitter/binding.c index 427a75b..a12fd14 100644 --- a/tree_sitter/binding.c +++ b/tree_sitter/binding.c @@ -102,14 +102,6 @@ typedef struct { PyTypeObject *lookahead_names_iterator_type; } ModuleState; -#if PY_MINOR_VERSION < 9 -static ModuleState *global_state = NULL; -static ModuleState *PyType_GetModuleState(PyTypeObject *obj) { return global_state; } -static PyObject *PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { - return PyType_FromSpecWithBases(spec, bases); -} -#endif - // Point static PyObject *point_new(TSPoint point) { @@ -2933,10 +2925,11 @@ static struct PyModuleDef module_definition = { .m_methods = module_methods, }; +// TODO(0.24): drop Python 3.9 support #if PY_MINOR_VERSION > 9 #define AddObjectRef PyModule_AddObjectRef #else -// simulate PyModule_AddObjectRef for pre-Python 3.10 +// simulate PyModule_AddObjectRef for Python 3.9 static int AddObjectRef(PyObject *module, const char *name, PyObject *value) { if (value == NULL) { PyErr_Format(PyExc_SystemError, "PyModule_AddObjectRef() %s == NULL", name); @@ -3011,9 +3004,6 @@ PyMODINIT_FUNC PyInit__binding(void) { goto cleanup; } -#if PY_MINOR_VERSION < 9 - global_state = state; -#endif return module; cleanup: