Skip to content

Commit

Permalink
feat: drop Python 3.8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Mar 12, 2024
1 parent cff4d96 commit 15e1990
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build_asan:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.8"
PYTHON_VERSION: "3.9"
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -29,7 +29,7 @@ name = "Max Brunsfeld"
email = "[email protected]"

[tool.ruff]
target-version = "py38"
target-version = "py39"
line-length = 100
indent-width = 4
extend-exclude = [
Expand Down
14 changes: 2 additions & 12 deletions tree_sitter/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -3011,9 +3004,6 @@ PyMODINIT_FUNC PyInit__binding(void) {
goto cleanup;
}

#if PY_MINOR_VERSION < 9
global_state = state;
#endif
return module;

cleanup:
Expand Down

0 comments on commit 15e1990

Please sign in to comment.