diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5075d24b..d3554a4b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,13 +10,13 @@ jobs: strategy: matrix: # Python maintains 5 versions, along with the to-be-released version. Every October, this changes. - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.10'] os: [ macos-latest, ubuntu-latest, windows-latest ] fail-fast: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2f57593..da039fe3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,11 +10,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.10'] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} @@ -34,7 +34,7 @@ jobs: matrix: python-version: [ '3.10' ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: true @@ -84,7 +84,7 @@ jobs: cibw_arch: "i686 x86_64 aarch64" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: true @@ -106,8 +106,11 @@ jobs: # See the following for the status of python versions (ie. what's EoL'd, security only, etc): # https://devguide.python.org/versions/ # - # At the time of writing, anything older than 3.9 is end-of-life. - CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" + # At the time of writing, anything older than 3.10 is end-of-life. (3.9 has no build + # for the Ubuntu 26.04 runners that ubuntu-latest now resolves to.) + # 3.15 is excluded until jsonconversion works with it: it calls the private + # json.encoder._make_iterencode with an isinstance= kwarg that 3.15 removed. + CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*" CIBW_ARCHS: ${{ matrix.cibw_arch }} CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }} diff --git a/README.md b/README.md index 90fc29bd..649d6519 100644 --- a/README.md +++ b/README.md @@ -86,13 +86,13 @@ installed Python. Install relevant versions of Python: ``` -$ for V in 3.8.10 3.9.5 do pyenv install $V; done +$ for V in 3.10.19 3.14.10; do pyenv install $V; done ``` Once you have these installations, add them as a local `pyenv` configuration ``` -$ pyenv local 3.8.10 3.9.5 +$ pyenv local 3.10.19 3.14.10 ``` Assuming you have `pyenv` properly set up (making sure `pyenv init` is evaluated into your shell), @@ -102,14 +102,14 @@ you can now run `tox`: # Run tox for all versions of python which executes py.test. $ tox -# Run tox for just Python 3.8 and 3.9. -$ tox -e py38,py39 +# Run tox for just Python 3.10 and 3.14. +$ tox -e py310,py314 # Run tox for a specific version and run py.test with high verbosity -$ tox -e py39 -- py.test -vv +$ tox -e py310 -- py.test -vv # Run tox for a specific version and just the virtual env REPL. -$ tox -e py39 -- python +$ tox -e py310 -- python ``` ## TODO diff --git a/pyproject.toml b/pyproject.toml index 7cb34c5c..3e66eaa1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "amazon-ion" readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" license = { "file" = "LICENSE" } authors = [{ "name" = "Amazon Ion Team", "email" = "ion-team@amazon.com" }] keywords = [] @@ -73,7 +73,7 @@ testpaths = ["tests"] # running our default unit tests (minus benchmarking related tests). This ensures that we # can easily test against supported python versions. [tool.tox] -envlist = ["py3.9", "pypy3"] # default environments to run. +envlist = ["py3.10", "pypy3"] # default environments to run. [tool.tox.env_run_base] extras = ["test"] diff --git a/src/ioncmodule.c b/src/ioncmodule.c index b53258d7..c8f3f058 100644 --- a/src/ioncmodule.c +++ b/src/ioncmodule.c @@ -308,14 +308,17 @@ static iERR ionc_write_symboltoken(hWRITER writer, PyObject* symboltoken, BOOL i static iERR ionc_write_annotations(hWRITER writer, PyObject* obj) { iENTER; PyObject* annotations = NULL; - annotations = PyObject_GetAttr(obj, ion_annotations_str); - if (annotations == NULL || PyObject_Not(annotations)) { + PyObject* attr = PyObject_GetAttr(obj, ion_annotations_str); + if (attr == NULL || PyObject_Not(attr)) { + Py_XDECREF(attr); PyErr_Clear(); // Proceed as if the attribute is not there. SUCCEED(); } - annotations = PySequence_Fast(annotations, "expected sequence"); + annotations = PySequence_Fast(attr, "expected sequence"); + Py_DECREF(attr); + if (annotations == NULL) FAILWITH(IERR_INVALID_ARG); Py_ssize_t len = PySequence_Size(annotations); Py_ssize_t i; @@ -333,7 +336,6 @@ static iERR ionc_write_annotations(hWRITER writer, PyObject* obj) { Py_DECREF(pyAnnotation); if (err) break; } - Py_XDECREF(annotations); fail: Py_XDECREF(annotations); cRETURN;