diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 2457650df..79d79d925 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -174,7 +174,9 @@ jobs: strategy: matrix: pyver: - - 3.13-freethreading + - 3.14t + - 3.14 + - 3.13t - 3.13 - 3.12 - 3.11 @@ -191,9 +193,9 @@ jobs: - os: windows no-extensions: Y - os: macos - pyver: 3.13-freethreading # this is still tested within cibuildwheel + pyver: 3.13t # this is still tested within cibuildwheel - os: windows - pyver: 3.13-freethreading # this is still tested within cibuildwheel + pyver: 3.13t # this is still tested within cibuildwheel - no-extensions: Y debug: Y include: @@ -237,18 +239,10 @@ jobs: path: dist - name: Setup Python ${{ matrix.pyver }} - if: >- - !endsWith(matrix.pyver, '-freethreading') uses: actions/setup-python@v5 with: python-version: ${{ matrix.pyver }} allow-prereleases: true - - name: Setup Python ${{ matrix.pyver }} - if: endsWith(matrix.pyver, '-freethreading') - uses: deadsnakes/action@v3.2.0 - with: - python-version: 3.13-dev - nogil: true - name: Compute runtime Python version id: python-install run: | diff --git a/.github/workflows/reusable-cibuildwheel.yml b/.github/workflows/reusable-cibuildwheel.yml index 2cd03b8b1..6c93a2580 100644 --- a/.github/workflows/reusable-cibuildwheel.yml +++ b/.github/workflows/reusable-cibuildwheel.yml @@ -108,7 +108,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v3.0.0 + uses: pypa/cibuildwheel@v3.1.4 with: package-dir: >- # not necessarily a dir, we pass an acceptable sdist dist/${{ inputs.source-tarball-name }} diff --git a/CHANGES/1235.contrib.rst b/CHANGES/1235.contrib.rst new file mode 100644 index 000000000..1d3602998 --- /dev/null +++ b/CHANGES/1235.contrib.rst @@ -0,0 +1 @@ +Updated tests and added CI for CPython 3.14 -- by :user:`kumaraditya303`. diff --git a/setup.cfg b/setup.cfg index 209e0d69a..36a4c7b47 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,6 +37,7 @@ classifiers = Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 Programming Language :: Python :: 3.13 + Programming Language :: Python :: 3.14 [options] python_requires = >= 3.9 diff --git a/tests/isolated/multidict_pop.py b/tests/isolated/multidict_pop.py index daced359e..89fcce11c 100644 --- a/tests/isolated/multidict_pop.py +++ b/tests/isolated/multidict_pop.py @@ -23,13 +23,15 @@ def get_memory_usage() -> int: return memory_info.rss / (1024 * 1024) # type: ignore[no-any-return] +initial_memory_usage = get_memory_usage() + keys = [f"X-Any-{i}" for i in range(100)] headers = {key: key * 2 for key in keys} def check_for_leak() -> None: trim_ram() - usage = get_memory_usage() + usage = get_memory_usage() - initial_memory_usage assert usage < 50, f"Memory leaked at: {usage} MB" diff --git a/tests/test_istr.py b/tests/test_istr.py index f02a23593..029f579b3 100644 --- a/tests/test_istr.py +++ b/tests/test_istr.py @@ -5,7 +5,6 @@ import pytest IMPLEMENTATION = getattr(sys, "implementation") # to suppress mypy error -GIL_ENABLED = getattr(sys, "_is_gil_enabled", lambda: True)() def test_ctor(case_insensitive_str_class: Type[str]) -> None: @@ -64,16 +63,14 @@ def _create_strs() -> None: IMPLEMENTATION.name != "cpython", reason="PyPy has different GC implementation", ) -@pytest.mark.skipif( - not GIL_ENABLED, - reason="free threading has different GC implementation", -) -def test_leak(create_istrs: Callable[[], None]) -> None: +def test_leak( + create_istrs: Callable[[], None], case_insensitive_str_class: Type[str] +) -> None: gc.collect() - cnt = len(gc.get_objects()) for _ in range(10000): create_istrs() gc.collect() - cnt2 = len(gc.get_objects()) - assert abs(cnt - cnt2) < 10 # on other GC impls these numbers are not equal + assert not any( + isinstance(obj, case_insensitive_str_class) for obj in gc.get_objects() + )