Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion mypyc/codegen/emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand Down
2 changes: 1 addition & 1 deletion mypyc/lib-rt/byteswriter_extra_ops.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef BYTESWRITER_EXTRA_OPS_H
#define BYTESWRITER_EXTRA_OPS_H

#include <Python.h>
#include <stdbool.h>
#include <stdint.h>
#include <Python.h>
Comment on lines +4 to -6
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some librt tests only compile individual c files. If Python.h isn't included first, these tests would raise ‘_POSIX_C_SOURCE’ redefined warnings on Python 3.15.

See https://bugzilla.redhat.com/show_bug.cgi?id=2416110 for a similar issue
https://docs.python.org/3/c-api/intro.html#include-files

--
No need to backport anything specifically as building librt completely works fine already. It's just if only individual files are compiled.


#include "mypyc_util.h"
#include "strings/librt_strings_api.h"
Expand Down
2 changes: 1 addition & 1 deletion mypyc/lib-rt/function_wrapper.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define PY_SSIZE_T_CLEAN
#include <stdint.h>
#include "CPy.h"
#include <stdint.h>

#define CPyFunction_weakreflist(f) (((PyCFunctionObject *)f)->m_weakreflist)
#define CPyFunction_class(f) ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
Expand Down
2 changes: 1 addition & 1 deletion mypyc/lib-rt/stringwriter_extra_ops.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef STRINGWRITER_EXTRA_OPS_H
#define STRINGWRITER_EXTRA_OPS_H

#include <Python.h>
#include <stdbool.h>
#include <stdint.h>
#include <Python.h>

#include "mypyc_util.h"
#include "strings/librt_strings_api.h"
Expand Down
5 changes: 4 additions & 1 deletion mypyc/test-data/run-misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion mypyc/test-data/run-python312.test
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 3.14 we added the classifier during the beta as well, once all tests passed. See #19199.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this, but it would be nice to make sure we support some of the headline features like lazy imports before we make a release with this classifier

"Topic :: Software Development",
"Typing :: Typed",
]
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ envlist =
py312,
py313,
py314,
py315,
docs,
lint,
type,
Expand Down
Loading