From 29c876b50c53e37539792aa272f68e904aac01ba Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Wed, 11 Feb 2026 05:31:11 +0300 Subject: [PATCH 01/22] Support ints in benchmarks (cherry picked from commit 3e11ab49484c19cc2c84eb05df141cc1d7da05de) --- bench/collatz.py | 2 ++ bench/mul.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/bench/collatz.py b/bench/collatz.py index 19826554..3b08a4a3 100644 --- a/bench/collatz.py +++ b/bench/collatz.py @@ -8,6 +8,8 @@ from gmpy2 import mpz elif os.getenv("T") == "flint.fmpz": from flint import fmpz as mpz +elif os.getenv("T") == "int": + mpz = int else: from gmp import mpz diff --git a/bench/mul.py b/bench/mul.py index 65ff8973..09cc5758 100644 --- a/bench/mul.py +++ b/bench/mul.py @@ -9,6 +9,8 @@ from gmpy2 import mpz elif os.getenv("T") == "flint.fmpz": from flint import fmpz as mpz +elif os.getenv("T") == "int": + mpz = int else: from gmp import mpz From 136899cfc8753b0ac8dd990cd702b9dc9acf3001 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 14 Feb 2026 10:36:09 +0300 Subject: [PATCH 02/22] Relax default timeout more (for PyPy) (cherry picked from commit ca418c5c83c666c0c8b19d5d7dc39aee8539dd4b) --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 5e638a67..f59aa7cd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,7 @@ def pytest_configure(config): from hypothesis import settings default = settings.get_profile("default") - settings.register_profile("default", settings(default, deadline=1600)) + settings.register_profile("default", settings(default, deadline=3000)) ci = settings.get_profile("ci") if platform.python_implementation() != "GraalVM": ci = settings(ci, max_examples=10000) From 450cba4593b1a47fe8ed1b1d71900698066331e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 12:05:44 +0000 Subject: [PATCH 03/22] Bump actions/download-artifact from 7 to 8 Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v7...v8) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] (cherry picked from commit b17ed8a8630d6a8ec4c95c65394423e5ee252288) --- .github/workflows/coverage.yml | 2 +- .github/workflows/publish.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 183c3b08..9901b04c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -64,7 +64,7 @@ jobs: fetch-depth: 0 - run: sudo apt-get update - run: sudo apt-get install lcov diff-cover - - uses: actions/download-artifact@v7 + - uses: actions/download-artifact@v8 with: pattern: coverage-* path: build/ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0b318483..5ec5d09c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,7 +45,7 @@ jobs: permissions: id-token: write steps: - - uses: actions/download-artifact@v7 + - uses: actions/download-artifact@v8 with: pattern: python-gmp-* path: dist/ @@ -62,7 +62,7 @@ jobs: contents: write id-token: write steps: - - uses: actions/download-artifact@v7 + - uses: actions/download-artifact@v8 with: pattern: python-gmp-* path: dist/ From 740d71e2cdb4c6ddf79720b53238147cfb04f748 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 12:05:53 +0000 Subject: [PATCH 04/22] Bump actions/upload-artifact from 6 to 7 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] (cherry picked from commit 3f216707c6b1a2eb92cdb396efe1f3777d033c2d) --- .github/workflows/coverage.yml | 4 ++-- .github/workflows/publish.yml | 2 +- .github/workflows/wheels.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 9901b04c..068bf75c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -48,7 +48,7 @@ jobs: lcov --remove coverage.info "*.h" --ignore-errors unused \ --output-file coverage.info cp coverage.info build/coverage-${{ matrix.python-version }}.info - - uses: actions/upload-artifact@v6 + - uses: actions/upload-artifact@v7 with: name: coverage-${{ matrix.python-version }} path: | @@ -75,7 +75,7 @@ jobs: - run: | diff-cover build/coverage*.info --fail-under=100 \ --compare-branch=origin/master - - uses: actions/upload-artifact@v6 + - uses: actions/upload-artifact@v7 with: name: coverage path: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5ec5d09c..34b77468 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,7 +26,7 @@ jobs: - run: python -m build -s env: PKG_CONFIG_PATH: ${{ github.workspace }}/.local/lib/pkgconfig - - uses: actions/upload-artifact@v6 + - uses: actions/upload-artifact@v7 with: name: python-gmp-sdist path: dist/ diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 554e9ee6..9906aed5 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -43,7 +43,7 @@ jobs: if: ${{ startsWith(matrix.os, 'windows') }} - name: Build wheels uses: pypa/cibuildwheel@v3.3.1 - - uses: actions/upload-artifact@v6 + - uses: actions/upload-artifact@v7 with: name: wheels-${{ matrix.os }} path: ./wheelhouse/ @@ -52,7 +52,7 @@ jobs: needs: build_wheels steps: - name: Merge Wheels - uses: actions/upload-artifact/merge@v6 + uses: actions/upload-artifact/merge@v7 with: name: python-gmp-wheels pattern: wheels-* From dab05d3bc88e006a9301616f5b10bf06388f4e65 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 2 Mar 2026 08:55:19 +0300 Subject: [PATCH 05/22] Improve dependabot settings * group multiple updates * forbid auto rebase to reduce cost of CI (Use `@dependabot rebase` manually instead.) (cherry picked from commit 234096da4fec9901cb6e82ed56eb5f2ee94bf2a6) --- .github/dependabot.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c05de277..a3e4fa0c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,8 @@ updates: directory: "/" schedule: interval: "monthly" + rebase-strategy: "disabled" + groups: + actions-deps: + patterns: + - "*" From 108dfc9e6a6a8c40bc48ab02b03ec2061106adc1 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 28 Mar 2026 06:08:05 +0300 Subject: [PATCH 06/22] Polish pytest_report_header() (cherry picked from commit f01195f9d905b626ce9eb5a5881c92597262289c) --- tests/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index f59aa7cd..090ec111 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,9 +20,9 @@ def pytest_report_header(config): print(f""" Using the ZZ library v{gmp._zz_version} - Bits per digit : {gmp.mpz_info.bits_per_digit} - sizeof(zz_digit_t): {gmp.mpz_info.sizeof_digit} - Maximal bit count : {gmp.mpz_info.bitcnt_max} + Bits per digit : {gmp.mpz_info.bits_per_digit} + sizeof(digit) : {gmp.mpz_info.sizeof_digit} + Maximal bit count: {gmp.mpz_info.bitcnt_max} The gmp module v{gmp.__version__} """) From 22e97ea54fc12533e32e8359e0ba1ebf9ed14471 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 28 Mar 2026 06:54:03 +0300 Subject: [PATCH 07/22] Use new runner images for MacOS/Windows (cherry picked from commit 78db2e57969db7f61c5e5a417946dd6a02a11a75) --- .github/workflows/wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9906aed5..d93f5975 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -6,8 +6,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15-intel, macos-15, - windows-2022] + os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26-intel, macos-26, + windows-2025] msystem: [ucrt64] menv: [ucrt-x86_64] include: From eaadfa06be55f0b9bc408423e247647f6289503f Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 28 Mar 2026 10:10:30 +0300 Subject: [PATCH 08/22] Refactor benchmarks, add sum and harmonic (cherry picked from commit 20b33d8d580efc4c1e8185061016fd8cc59f88d1) --- bench/README.rst | 1 + bench/collatz.py | 13 ++----------- bench/harmonic.py | 12 ++++++++++++ bench/mul.py | 12 ++---------- bench/sum.py | 10 ++++++++++ bench/utils.py | 17 +++++++++++++++++ 6 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 bench/harmonic.py create mode 100644 bench/sum.py create mode 100644 bench/utils.py diff --git a/bench/README.rst b/bench/README.rst index 474d3da7..a5fae97b 100644 --- a/bench/README.rst +++ b/bench/README.rst @@ -5,6 +5,7 @@ It's possible to run them also with gmpy2's and flint's integer types: .. code:: sh ( export T="gmpy2.mpz"; \ + export PYTHONPATH=. ; \ python bench/mul.py -q --copy-env --rigorous -o $T.json ) Beware, that the gmp prefers clang over gcc and extensions might diff --git a/bench/collatz.py b/bench/collatz.py index 3b08a4a3..ee60f630 100644 --- a/bench/collatz.py +++ b/bench/collatz.py @@ -1,17 +1,8 @@ -# collatz.py - -import os +# bench/collatz.py import pyperf -if os.getenv("T") == "gmpy2.mpz": - from gmpy2 import mpz -elif os.getenv("T") == "flint.fmpz": - from flint import fmpz as mpz -elif os.getenv("T") == "int": - mpz = int -else: - from gmp import mpz +from bench.utils import mpz zero = mpz(0) one = mpz(1) diff --git a/bench/harmonic.py b/bench/harmonic.py new file mode 100644 index 00000000..067fa21c --- /dev/null +++ b/bench/harmonic.py @@ -0,0 +1,12 @@ +# bench/harmonic.py + +from fractions import Fraction + +import pyperf + +from bench.utils import mpz, mysum + +runner = pyperf.Runner() +for n in [100, 1000]: + xs = [Fraction(mpz(1), mpz(i)) for i in range(1, n + 1)] + runner.bench_func(f"H({n})", mysum, xs) diff --git a/bench/mul.py b/bench/mul.py index 09cc5758..b7e6f056 100644 --- a/bench/mul.py +++ b/bench/mul.py @@ -1,18 +1,10 @@ -# mul.py +# bench/mul.py -import os from operator import mul import pyperf -if os.getenv("T") == "gmpy2.mpz": - from gmpy2 import mpz -elif os.getenv("T") == "flint.fmpz": - from flint import fmpz as mpz -elif os.getenv("T") == "int": - mpz = int -else: - from gmp import mpz +from bench.utils import mpz values = ["1<<7", "1<<38", "1<<300", "1<<3000"] diff --git a/bench/sum.py b/bench/sum.py new file mode 100644 index 00000000..1d348f50 --- /dev/null +++ b/bench/sum.py @@ -0,0 +1,10 @@ +# bench/sum.py + +import pyperf + +from bench.utils import mpz, mysum + +runner = pyperf.Runner() +for n in [100, 1000]: + xs = [mpz(i) for i in range(1, n + 1)] + runner.bench_func(f"sum({n})", mysum, xs) diff --git a/bench/utils.py b/bench/utils.py new file mode 100644 index 00000000..a21e46df --- /dev/null +++ b/bench/utils.py @@ -0,0 +1,17 @@ +import os + +if os.getenv("T") == "gmpy2.mpz": + from gmpy2 import mpz +elif os.getenv("T") == "flint.fmpz": + from flint import fmpz as mpz +elif os.getenv("T") == "int": + mpz = int +else: + pass + + +def mysum(xs): + total = xs[0] + for t in xs[1:]: + total += t + return t From 4d1a8c955f5f455ccbc97bf8adabff9b8a4d39a2 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 28 Mar 2026 10:57:53 +0300 Subject: [PATCH 09/22] Update msys2/setup-msys2 action (cherry picked from commit c619768f0fd59a21dcd303db2ad641fe8930dad5) --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d93f5975..f42ce0cb 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v6 with: fetch-depth: 0 - - uses: msys2/setup-msys2@v2.30.0 + - uses: msys2/setup-msys2@v2.31.0 name: Setup msys2 with: install: >- From b65c4738ee23326cc1aaad6e5555da7a09106b19 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 29 Mar 2026 09:54:16 +0300 Subject: [PATCH 10/22] Amend 20b33d8 (cherry picked from commit 6a535eb382a9f7bfa348b1eac91a917963a25eac) --- bench/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/utils.py b/bench/utils.py index a21e46df..49234f1a 100644 --- a/bench/utils.py +++ b/bench/utils.py @@ -7,7 +7,7 @@ elif os.getenv("T") == "int": mpz = int else: - pass + from gmp import mpz # noqa: F401 def mysum(xs): From 6421b149667d4f28d15d84670351a93bcf6f6400 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 19:09:19 +0000 Subject: [PATCH 11/22] Bump the actions-deps group with 4 updates Bumps the actions-deps group with 4 updates: [sorenlouv/backport-github-action](https://github.com/sorenlouv/backport-github-action), [codecov/codecov-action](https://github.com/codecov/codecov-action), [sigstore/gh-action-sigstore-python](https://github.com/sigstore/gh-action-sigstore-python) and [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel). Updates `sorenlouv/backport-github-action` from 10.2.0 to 11.0.0 - [Release notes](https://github.com/sorenlouv/backport-github-action/releases) - [Commits](https://github.com/sorenlouv/backport-github-action/compare/v10.2.0...v11.0.0) Updates `codecov/codecov-action` from 5 to 6 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v5...v6) Updates `sigstore/gh-action-sigstore-python` from 3.2.0 to 3.3.0 - [Release notes](https://github.com/sigstore/gh-action-sigstore-python/releases) - [Changelog](https://github.com/sigstore/gh-action-sigstore-python/blob/main/CHANGELOG.md) - [Commits](https://github.com/sigstore/gh-action-sigstore-python/compare/v3.2.0...v3.3.0) Updates `pypa/cibuildwheel` from 3.3.1 to 3.4.0 - [Release notes](https://github.com/pypa/cibuildwheel/releases) - [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md) - [Commits](https://github.com/pypa/cibuildwheel/compare/v3.3.1...v3.4.0) --- updated-dependencies: - dependency-name: sorenlouv/backport-github-action dependency-version: 11.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: codecov/codecov-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps - dependency-name: sigstore/gh-action-sigstore-python dependency-version: 3.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps - dependency-name: pypa/cibuildwheel dependency-version: 3.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-deps ... Signed-off-by: dependabot[bot] (cherry picked from commit d4afd250ff49ca9eb85d4af5f1cd736e45d6cc58) --- .github/workflows/backport.yml | 2 +- .github/workflows/coverage.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/wheels.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 56d58396..fb1e4bcf 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -25,7 +25,7 @@ jobs: echo "matched=$matched" >> $GITHUB_OUTPUT - name: Backport Action if: fromJSON(steps.check_labels.outputs.matched) > 0 - uses: sorenlouv/backport-github-action@v10.2.0 + uses: sorenlouv/backport-github-action@v11.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} auto_backport_label_prefix: backport-to- diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 068bf75c..f5292d90 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -81,7 +81,7 @@ jobs: path: | build/coverage/ build/coverage*.info - - uses: codecov/codecov-action@v5 + - uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} gcov_ignore: pythoncapi_compat.h diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 34b77468..e7991db1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -67,7 +67,7 @@ jobs: pattern: python-gmp-* path: dist/ merge-multiple: true - - uses: sigstore/gh-action-sigstore-python@v3.2.0 + - uses: sigstore/gh-action-sigstore-python@v3.3.0 with: inputs: >- ./dist/*.tar.gz diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index f42ce0cb..35be796d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -42,7 +42,7 @@ jobs: - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV if: ${{ startsWith(matrix.os, 'windows') }} - name: Build wheels - uses: pypa/cibuildwheel@v3.3.1 + uses: pypa/cibuildwheel@v3.4.0 - uses: actions/upload-artifact@v7 with: name: wheels-${{ matrix.os }} From 58354226f79371c0ef1049b4975ef5e579e39436 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 3 Apr 2026 05:50:32 +0300 Subject: [PATCH 12/22] Drop most workarounds for PyPy3.11 See #233 (cherry picked from commit de89f9082142d6e1986caa9b56bd89e08efccd97) --- tests/test_mpz.py | 14 +++++--------- utils.h | 16 ++-------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/tests/test_mpz.py b/tests/test_mpz.py index 03f8659a..8de221ef 100644 --- a/tests/test_mpz.py +++ b/tests/test_mpz.py @@ -127,9 +127,9 @@ def test_format_interface(): mx.__format__(321) with pytest.raises(ValueError, match="Unknown format code"): format(mx, "q") - if platform.python_implementation() != "PyPy": # XXX: pypy/pypy#5311 - with pytest.raises(ValueError, match="Unknown format code"): - format(mx, "\x81") + with pytest.raises(ValueError, + match="(Unknown format code|Invalid format specifier)"): + format(mx, "\x81") with pytest.raises(ValueError, match=(r"Negative zero coercion \(z\) not allowed|" "Invalid conversion specification")): @@ -195,10 +195,6 @@ def test_format_interface(): assert format(mx, ".,f") == "123.000,000" assert format(mx, "._f") == "123.000_000" - if (platform.python_implementation() == "PyPy" - and sys.pypy_version_info[:3] <= (7, 3, 20)): - return # XXX: pypy/pypy#5311 - try: locale.setlocale(locale.LC_ALL, "ru_RU.UTF-8") s = locale.localeconv()["thousands_sep"] @@ -700,11 +696,11 @@ def test_power_mod(x, y, z): assert pow(mx, my, mz) == r assert pow(mx, my, z) == r assert pow(mx, y, mz) == r - if platform.python_implementation() == "PyPy": - return # XXX: pypy/pypy#5207 assert pow(x, my, mz) == r assert pow(mx, y, z) == r assert pow(x, my, z) == r + if platform.python_implementation() == "PyPy": + return # XXX: pypy/pypy#5207 assert pow(x, y, mz) == r diff --git a/utils.h b/utils.h index f13b23c1..4bf83020 100644 --- a/utils.h +++ b/utils.h @@ -1,14 +1,8 @@ #ifndef UTILS_H #define UTILS_H -#if defined(__MINGW32__) && defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Warray-bounds" -#endif -#if defined(__clang__) -# pragma GCC diagnostic push /* XXX: pypy/pypy#5312 */ -# pragma GCC diagnostic ignored "-Wnewline-eof" -#endif +/* For GraalVM: unicodeobject.h, implicit conversion changes + signedness: 'enum PyUnicode_Kind' to 'int' */ #if defined(__GNUC__) || defined(__clang__) # pragma GCC diagnostic push /* XXX: oracle/graalpython#580 */ # pragma GCC diagnostic ignored "-Wsign-conversion" @@ -22,12 +16,6 @@ #if defined(__GNUC__) || defined(__clang__) # pragma GCC diagnostic pop #endif -#if defined(__clang__) -# pragma GCC diagnostic pop -#endif -#if defined(__MINGW32__) && defined(__GNUC__) -# pragma GCC diagnostic pop -#endif typedef struct gmp_pyargs { Py_ssize_t maxpos; From 9cc164948f65a392adda2c7f5eed6f72bf5f5c11 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 3 Apr 2026 06:16:01 +0300 Subject: [PATCH 13/22] Update pypa/cibuildwheel to v3.4.1 (cherry picked from commit 1543e3c10f5f12b57132ea72ec1f9efccd694514) --- .github/workflows/wheels.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 35be796d..e62cfdde 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -42,7 +42,7 @@ jobs: - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV if: ${{ startsWith(matrix.os, 'windows') }} - name: Build wheels - uses: pypa/cibuildwheel@v3.4.0 + uses: pypa/cibuildwheel@v3.4.1 - uses: actions/upload-artifact@v7 with: name: wheels-${{ matrix.os }} diff --git a/pyproject.toml b/pyproject.toml index fdaac951..55976962 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ select = ["E", "F", "I", "PT", "W", "Q", "SIM"] [tool.cibuildwheel] build-frontend = {name="build", args=["--verbose", "-Csetup-args=--vsenv"]} -enable = "pypy cpython-prerelease cpython-freethreading graalpy" +enable = "pypy cpython-prerelease graalpy" skip = "gp311_242* gp3*win*amd64*" before-all = "sh scripts/cibw_before_all.sh" From 46d87c12153196231bb184d0fd9f3f7a43998399 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 3 Apr 2026 04:53:01 +0300 Subject: [PATCH 14/22] Test types, returned by mpmath.libmp.libmpf.* (cherry picked from commit 8a5c70630762f022b5aebc0e3938525f5b9f77be) --- tests/test_functions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_functions.py b/tests/test_functions.py index cceab97e..dc63a7d9 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -142,6 +142,7 @@ def test_mpmath_normalize(sign, man, exp, prec, rnd): sign = int(sign) bc = mman.bit_length() res = mpmath.libmp.libmpf._normalize(sign, man, exp, bc, prec, rnd) + assert all(type(_) is int for _ in res) assert _mpmath_normalize(sign, mman, exp, bc, prec, rnd) == res @@ -154,6 +155,7 @@ def test_mpmath_create(man, exp, prec, rnd): mpmath = pytest.importorskip("mpmath") mman = mpz(man) res = mpmath.libmp.from_man_exp(man, exp, prec, rnd) + assert all(type(_) is int for _ in res) assert _mpmath_create(mman, exp, prec, rnd) == res assert mman == man assert _mpmath_create(man, exp, prec, rnd) == res From b9bb0457928579e9323eb6868f9cc303e5721e0c Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Fri, 3 Apr 2026 08:54:00 +0300 Subject: [PATCH 15/22] Drop some workaround for oracle/graalpython#534 See #232 (cherry picked from commit 9d59a121dd46edb2469561b22b0f892a241fe99a) --- tests/test_mpz.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_mpz.py b/tests/test_mpz.py index 8de221ef..601f8f4a 100644 --- a/tests/test_mpz.py +++ b/tests/test_mpz.py @@ -513,8 +513,6 @@ def test_divmod_bulk(x, y): with pytest.raises(ZeroDivisionError): x % my return - if y < 0 and platform.python_implementation() == "GraalVM": - return # issue oracle/graalpython#534 r = x // y assert mx // my == r assert mx // y == r From 0d79cc3f7119edb6461d38252d6d230c2f12f8e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 13:59:43 +0000 Subject: [PATCH 16/22] Bump msys2/setup-msys2 from 2.31.0 to 2.31.1 in the actions-deps group Bumps the actions-deps group with 1 update: [msys2/setup-msys2](https://github.com/msys2/setup-msys2). Updates `msys2/setup-msys2` from 2.31.0 to 2.31.1 - [Release notes](https://github.com/msys2/setup-msys2/releases) - [Changelog](https://github.com/msys2/setup-msys2/blob/main/CHANGELOG.md) - [Commits](https://github.com/msys2/setup-msys2/compare/v2.31.0...v2.31.1) --- updated-dependencies: - dependency-name: msys2/setup-msys2 dependency-version: 2.31.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions-deps ... Signed-off-by: dependabot[bot] (cherry picked from commit 3e9a202cc1538c9f3d70216103c0e8b7a74f0c87) --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e62cfdde..5ddff4fc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v6 with: fetch-depth: 0 - - uses: msys2/setup-msys2@v2.31.0 + - uses: msys2/setup-msys2@v2.31.1 name: Setup msys2 with: install: >- From 297a06e191c8e833b8aca6984951dcf23abd6d82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jun 2026 11:03:43 +0000 Subject: [PATCH 17/22] Bump sorenlouv/backport-github-action in the actions-deps group Bumps the actions-deps group with 1 update: [sorenlouv/backport-github-action](https://github.com/sorenlouv/backport-github-action). Updates `sorenlouv/backport-github-action` from 11.0.0 to 12.0.0 - [Release notes](https://github.com/sorenlouv/backport-github-action/releases) - [Commits](https://github.com/sorenlouv/backport-github-action/compare/v11.0.0...v12.0.0) --- updated-dependencies: - dependency-name: sorenlouv/backport-github-action dependency-version: 12.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-deps ... Signed-off-by: dependabot[bot] (cherry picked from commit fa9b77c8860d7efba833390429f9f541a04019dc) --- .github/workflows/backport.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index fb1e4bcf..a9b20369 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -25,7 +25,7 @@ jobs: echo "matched=$matched" >> $GITHUB_OUTPUT - name: Backport Action if: fromJSON(steps.check_labels.outputs.matched) > 0 - uses: sorenlouv/backport-github-action@v11.0.0 + uses: sorenlouv/backport-github-action@v12.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} auto_backport_label_prefix: backport-to- From ffc47e8f1caa00186add12de16ebe148d960f5f0 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 8 Jun 2026 05:35:34 +0300 Subject: [PATCH 18/22] Use pypa/cibuildwheel v4.0.0 (cherry picked from commit 01a61a1759c82c0320b58c583ac3e9a24c2759ba) --- .github/workflows/wheels.yml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5ddff4fc..66263a5f 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26-intel, macos-26, - windows-2025] + windows-2025-vs2026] msystem: [ucrt64] menv: [ucrt-x86_64] include: @@ -42,7 +42,7 @@ jobs: - run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV if: ${{ startsWith(matrix.os, 'windows') }} - name: Build wheels - uses: pypa/cibuildwheel@v3.4.1 + uses: pypa/cibuildwheel@v4.0.0 - uses: actions/upload-artifact@v7 with: name: wheels-${{ matrix.os }} diff --git a/pyproject.toml b/pyproject.toml index 55976962..67e96b63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,7 @@ select = ["E", "F", "I", "PT", "W", "Q", "SIM"] [tool.cibuildwheel] build-frontend = {name="build", args=["--verbose", "-Csetup-args=--vsenv"]} enable = "pypy cpython-prerelease graalpy" -skip = "gp311_242* gp3*win*amd64*" +skip = "gp3*win*amd64*" before-all = "sh scripts/cibw_before_all.sh" test-extras = "ci" From ec33b314d232d08d038c50a6a584ac23fd22db60 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Mon, 8 Jun 2026 07:28:22 +0300 Subject: [PATCH 19/22] Remove workarounds for PyPy Closes #233 (cherry picked from commit 19523497037922aaf863442309380759611c72f6) --- tests/test_functions.py | 5 ++--- tests/test_mpz.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/test_functions.py b/tests/test_functions.py index dc63a7d9..41adf211 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -235,9 +235,8 @@ def test_interfaces(): _mpmath_normalize(1, mpz(111), 11, 12, 13, 1j) -# See pypy/pypy#5368 and oracle/graalpython#593 -@pytest.mark.skipif(platform.python_implementation() != "CPython", - reason="no way to specify a signature") +@pytest.mark.skipif(platform.python_implementation() == "GraalVM", + reason="oracle/graalpython#593") def test_func_api(): for fn in ["comb", "factorial", "gcd", "isqrt", "lcm", "perm"]: f = getattr(math, fn) diff --git a/tests/test_mpz.py b/tests/test_mpz.py index 601f8f4a..e1b272c6 100644 --- a/tests/test_mpz.py +++ b/tests/test_mpz.py @@ -1069,9 +1069,8 @@ def f(n): assert all(f.result() == 1 for f in futures) -# See pypy/pypy#5368 and oracle/graalpython#593 -@pytest.mark.skipif(platform.python_implementation() != "CPython", - reason="no way to specify a signature") +@pytest.mark.skipif(platform.python_implementation() == "GraalVM", + reason="oracle/graalpython#593") def test_int_api(): for meth in dir(int): m = getattr(int, meth) From 3a0d45793bf7176c74a269a074b9f4f422bb149d Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 9 Jun 2026 07:30:08 +0300 Subject: [PATCH 20/22] Use j178/prek-action Closes #341 (cherry picked from commit 79d02932e8dd259105ebca1726f5257101f661f1) --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index f28cd489..5baf1700 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -10,4 +10,4 @@ jobs: - uses: actions/setup-python@v6 with: python-version: "3.x" - - uses: pre-commit/action@v3.0.1 + - uses: j178/prek-action@v2 From a38b4a0d0975dfa73c5eb081e22e288d9821302a Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 20 Jun 2026 08:59:52 +0300 Subject: [PATCH 21/22] Support CPython v3.15 (cherry picked from commit ba1f450e40d3bab0d06134de1522b49ed4c64c97) --- README.rst | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index aa437551..5bb44755 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,7 @@ functions, compatible with the Python stdlib's submodule `math.integer `_. This module requires Python 3.11 or later versions and has been tested with -CPython 3.11 through 3.14, with PyPy3.11 7.3.20 and with GraalPy 25.0. +CPython 3.11 through 3.15, with PyPy3.11 7.3.20 and with GraalPy 25.0. Free-threading builds of the CPython are supported. Releases are available in the Python Package Index (PyPI) at diff --git a/pyproject.toml b/pyproject.toml index 67e96b63..5806366e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = ["Development Status :: 4 - Beta", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Programming Language :: Python :: Free Threading :: 2 - Beta", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", From 0f8fd617569b9a5355e28c9d33c925cd735c9ca2 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 20 Jun 2026 09:00:54 +0300 Subject: [PATCH 22/22] Update PyPy/GraalPy versions in the README.rst (cherry picked from commit 261f6e0bee970ea2a25dac245b2f879202d08159) --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5bb44755..93b9bdd4 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,7 @@ functions, compatible with the Python stdlib's submodule `math.integer `_. This module requires Python 3.11 or later versions and has been tested with -CPython 3.11 through 3.15, with PyPy3.11 7.3.20 and with GraalPy 25.0. +CPython 3.11 through 3.15, with PyPy3.11 7.3.23 and with GraalPy 25.0.3. Free-threading builds of the CPython are supported. Releases are available in the Python Package Index (PyPI) at