From 1564ab5de65754e862ce08201eb0a2311b12a1ef Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 8 May 2026 11:05:49 +0200 Subject: [PATCH 1/6] Start testing Python 3.15 --- .github/workflows/test.yml | 7 +++++++ tox.ini | 1 + 2 files changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5242739f8f846..27fa756b7f607 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,6 +59,12 @@ jobs: toxenv: py tox_extra_args: "-n 4" test_mypyc: true + - name: Test suite with py315-ubuntu, mypyc-compiled + python: '3.15' + os: ubuntu-24.04-arm + toxenv: py + tox_extra_args: "-n 4" + test_mypyc: true - name: Test suite with py314t-ubuntu, mypyc-compiled python: '3.14t' os: ubuntu-24.04-arm @@ -196,6 +202,7 @@ jobs: if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }} with: python-version: ${{ matrix.python }} + allow-prereleases: true - name: Install tox run: | diff --git a/tox.ini b/tox.ini index 2126970afa991..ab81b00d121f5 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ envlist = py312, py313, py314, + py315, docs, lint, type, From cdbfe44127d265a245a71091ef12e272e4795b63 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 9 May 2026 00:15:15 +0200 Subject: [PATCH 2/6] Update virtualenv pin --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 8ac31e0b34666..1c8d7522fb7ba 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -67,7 +67,7 @@ types-setuptools==80.9.0.20250822 # via -r build-requirements.txt typing-extensions==4.15.0 # via -r mypy-requirements.txt -virtualenv==20.34.0 +virtualenv==20.35.4 # via pre-commit # The following packages are considered to be unsafe in a requirements file: From ca124141e0ee9dca6ac7bc756066dd10911dd7b1 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 8 May 2026 11:36:39 +0200 Subject: [PATCH 3/6] Update pygments pin --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 1c8d7522fb7ba..60e582bc12fe0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -46,7 +46,7 @@ pre-commit==4.3.0 # via -r test-requirements.in psutil==7.1.0 # via -r test-requirements.in -pygments==2.19.2 +pygments==2.20.0 # via pytest pytest==8.4.2 # via From 9227bdfe780527537426527e74090abb9b7e8f6c Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 9 May 2026 00:30:17 +0200 Subject: [PATCH 4/6] Fix tests --- mypyc/codegen/emit.py | 2 +- mypyc/test-data/run-misc.test | 5 ++++- mypyc/test-data/run-python312.test | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mypyc/codegen/emit.py b/mypyc/codegen/emit.py index 54e77836a76ca..d2c7d3e1464e7 100644 --- a/mypyc/codegen/emit.py +++ b/mypyc/codegen/emit.py @@ -233,7 +233,7 @@ def object_annotation(self, obj: object, line: str) -> str: If it contains illegal characters, an empty string is returned.""" line_width = self._indent + len(line) - formatted = pprint.pformat(obj, compact=True, width=max(90 - line_width, 20)) + formatted = pprint.pformat(obj, compact=True, indent=1, width=max(90 - line_width, 20)) if any(x in formatted for x in ("/*", "*/", "\0")): return "" diff --git a/mypyc/test-data/run-misc.test b/mypyc/test-data/run-misc.test index eda44e16871f2..d48884ada853a 100644 --- a/mypyc/test-data/run-misc.test +++ b/mypyc/test-data/run-misc.test @@ -971,7 +971,10 @@ print(z) [case testCheckVersion] import sys -if sys.version_info[:2] == (3, 15): +if sys.version_info[:2] == (3, 16): + def version() -> int: + return 16 +elif sys.version_info[:2] == (3, 15): def version() -> int: return 15 elif sys.version_info[:2] == (3, 14): diff --git a/mypyc/test-data/run-python312.test b/mypyc/test-data/run-python312.test index 5ed6dca9ecb28..f3dc272fc9fa1 100644 --- a/mypyc/test-data/run-python312.test +++ b/mypyc/test-data/run-python312.test @@ -229,9 +229,10 @@ type C[*Ts] = tuple[*Ts] def test_type_var_tuple_type_alias() -> None: if sys.version_info >= (3, 15): # type: ignore[operator] assert str(C[int, str]) == "_frozen_importlib.C[int, str]" + assert str(getattr(C, "__value__")) == "tuple[typing.Unpack[~Ts]]" else: assert str(C[int, str]) == "C[int, str]" - assert str(getattr(C, "__value__")) == "tuple[typing.Unpack[Ts]]" + assert str(getattr(C, "__value__")) == "tuple[typing.Unpack[Ts]]" type D[**P] = Callable[P, int] From 6e168e63130e7dc96e0961a11643e0bd96d2daf4 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 9 May 2026 00:48:51 +0200 Subject: [PATCH 5/6] Reorder include --- mypyc/lib-rt/byteswriter_extra_ops.h | 2 +- mypyc/lib-rt/function_wrapper.c | 2 +- mypyc/lib-rt/stringwriter_extra_ops.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mypyc/lib-rt/byteswriter_extra_ops.h b/mypyc/lib-rt/byteswriter_extra_ops.h index dc715600653d5..4aec322a730cd 100644 --- a/mypyc/lib-rt/byteswriter_extra_ops.h +++ b/mypyc/lib-rt/byteswriter_extra_ops.h @@ -1,9 +1,9 @@ #ifndef BYTESWRITER_EXTRA_OPS_H #define BYTESWRITER_EXTRA_OPS_H +#include #include #include -#include #include "mypyc_util.h" #include "strings/librt_strings_api.h" diff --git a/mypyc/lib-rt/function_wrapper.c b/mypyc/lib-rt/function_wrapper.c index ccb1824d24b4a..348c3316cd258 100644 --- a/mypyc/lib-rt/function_wrapper.c +++ b/mypyc/lib-rt/function_wrapper.c @@ -1,6 +1,6 @@ #define PY_SSIZE_T_CLEAN -#include #include "CPy.h" +#include #define CPyFunction_weakreflist(f) (((PyCFunctionObject *)f)->m_weakreflist) #define CPyFunction_class(f) ((PyObject*) ((PyCMethodObject *) (f))->mm_class) diff --git a/mypyc/lib-rt/stringwriter_extra_ops.h b/mypyc/lib-rt/stringwriter_extra_ops.h index 0da9a4d9d7f71..bac6dd6b3e95c 100644 --- a/mypyc/lib-rt/stringwriter_extra_ops.h +++ b/mypyc/lib-rt/stringwriter_extra_ops.h @@ -1,9 +1,9 @@ #ifndef STRINGWRITER_EXTRA_OPS_H #define STRINGWRITER_EXTRA_OPS_H +#include #include #include -#include #include "mypyc_util.h" #include "strings/librt_strings_api.h" From 4fda5ee25f109a97051d117940ec09518a60dd01 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 9 May 2026 01:32:14 +0200 Subject: [PATCH 6/6] Add classifier for Python 3.15 --- pyproject.toml | 1 + test-data/unit/cmdline.test | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9313335b0d969..050b7027719fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Topic :: Software Development", "Typing :: Typed", ] diff --git a/test-data/unit/cmdline.test b/test-data/unit/cmdline.test index eb8f4931fa2fe..cfba7a81e9285 100644 --- a/test-data/unit/cmdline.test +++ b/test-data/unit/cmdline.test @@ -363,11 +363,11 @@ mypy: error: Mypy no longer supports checking Python 2 code. Consider pinning to python_version = 3.10 [out] -[case testPythonVersionAccepted314] +[case testPythonVersionAccepted315] # cmd: mypy -c pass [file mypy.ini] \[mypy] -python_version = 3.14 +python_version = 3.15 [out] [case testPythonVersionFallback]