From 7613d280841747fedcb47af9abc68e0c6e7861cb Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 25 Oct 2026 16:48:52 +0000 Subject: [PATCH 1/4] Drop support for Python 3.10. --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 60c7eb4..02c8792 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changes 8.6 (unreleased) ---------------- +- Drop support for Python 3.10. + - Add a "Security considerations" documentation page. It explains why the guards only cover attribute access written in the restricted source, and why providing an ``__import__`` implementation hands the security boundary to the From 3b971783e6726c873e850a281ccf21c165af9ab7 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 25 Oct 2026 16:48:53 +0000 Subject: [PATCH 2/4] Configuring for pure-python --- .github/workflows/pre-commit.yml | 2 +- .github/workflows/tests.yml | 13 ++++++------- .gitignore | 2 ++ .meta.toml | 2 +- .pre-commit-config.yaml | 2 +- pyproject.toml | 3 +-- tox.ini | 4 +--- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 961588e..f507fed 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -30,7 +30,7 @@ jobs: extra_args: --all-files --show-diff-on-failure env: PRE_COMMIT_COLOR: always - - uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0 + - uses: pre-commit-ci/lite-action@062bca0919bc9d6e66755cc05074b70c77e111fc #v1.2.0 if: always() with: msg: Apply pre-commit code formatting diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f7f8bc7..fdf516b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,6 @@ jobs: config: # [Python version, tox env] - ["3.11", "release-check"] - - ["3.10", "py310"] - ["3.11", "py311"] - ["3.12", "py312"] - ["3.13", "py313"] @@ -47,8 +46,8 @@ jobs: with: persist-credentials: false - name: Install uv + caching - # astral/setup-uv@10.0.1 - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d + # astral/setup-uv@10.3.0 + uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 with: enable-cache: true cache-dependency-glob: | @@ -72,7 +71,7 @@ jobs: - name: Build package artifacts if: > matrix.os[0] == 'ubuntu' - && matrix.config[1] == 'py314' + && matrix.config[1] == 'py315' run: | rm -f dist/* pip install -U packaging "setuptools >= 78.1.1,< 82" wheel twine @@ -82,7 +81,7 @@ jobs: - name: Upload package wheel if: > matrix.os[0] == 'ubuntu' - && matrix.config[1] == 'py314' + && matrix.config[1] == 'py315' uses: actions/upload-artifact@v7 with: name: RestrictedPython.whl @@ -91,7 +90,7 @@ jobs: - name: Upload package source distribution if: > matrix.os[0] == 'ubuntu' - && matrix.config[1] == 'py314' + && matrix.config[1] == 'py315' uses: actions/upload-artifact@v7 with: name: RestrictedPython.tar.gz @@ -124,7 +123,7 @@ jobs: ls -lR dist/ - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: skip-existing: true packages-dir: dist/ diff --git a/.gitignore b/.gitignore index 188120b..623fa46 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ .installed.cfg .mr.developer.cfg .tox/ +.venv .vscode/ __pycache__/ bin/ @@ -30,4 +31,5 @@ parts/ pyvenv.cfg share/ testing.log +uv.lock var/ diff --git a/.meta.toml b/.meta.toml index 6c290a0..035f6c7 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/src/zope/meta/pure-python [meta] template = "pure-python" -commit-id = "7cab96bb" +commit-id = "1bebcaa5" [python] with-pypy = false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 31b70dc..69bb607 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: rev: v3.21.2 hooks: - id: pyupgrade - args: [--py310-plus] + args: [--py311-plus] - repo: https://github.com/isidentical/teyit rev: 0.4.3 hooks: diff --git a/pyproject.toml b/pyproject.toml index 12f0e9c..367f456 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,6 @@ classifiers = [ "Programming Language :: Python", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", @@ -28,7 +27,7 @@ classifiers = [ "Typing :: Typed", ] dynamic = ["readme"] -requires-python = ">=3.10, <3.16" +requires-python = ">=3.11" authors = [ {name = "Zope Foundation and contributors",email = "zope-dev@zope.dev"}, ] diff --git a/tox.ini b/tox.ini index 1a42732..a5953b1 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,6 @@ minversion = 3.18 envlist = release-check lint - py310 py311 py312 py313 @@ -19,7 +18,6 @@ envlist = usedevelop = true package = wheel wheel_build_env = .pkg -pip_pre = py315: true deps = setuptools >= 78.1.1,< 82 datetime: DateTime @@ -98,4 +96,4 @@ commands = coverage run -a -m sphinx -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest coverage html coverage report -depends = py310,py311,py312,py313,py314,py315,py311-datetime +depends = py311,py312,py313,py314,py315,py311-datetime From 0830f9faf5ade47b3c08d7db8252899b8e83a05a Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Tue, 3 Nov 2026 16:14:58 +0100 Subject: [PATCH 3/4] Update pyproject.toml Co-authored-by: Jens Vagelpohl --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 367f456..e6bb12a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ "Typing :: Typed", ] dynamic = ["readme"] -requires-python = ">=3.11" +requires-python = ">=3.11,<3.16" authors = [ {name = "Zope Foundation and contributors",email = "zope-dev@zope.dev"}, ] From 93273f7156c8a215ab2d9bdacaa4a536103ad27a Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Wed, 4 Nov 2026 08:53:51 +0100 Subject: [PATCH 4/4] Remove Python 3.10 leftovers. --- src/RestrictedPython/_compat.py | 1 - src/RestrictedPython/compile.py | 2 -- tests/test_compile.py | 11 +++-------- tests/transformer/test_try.py | 7 ------- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/RestrictedPython/_compat.py b/src/RestrictedPython/_compat.py index 5ae4b84..f3dda07 100644 --- a/src/RestrictedPython/_compat.py +++ b/src/RestrictedPython/_compat.py @@ -3,7 +3,6 @@ _version = sys.version_info -IS_PY311_OR_GREATER = _version.major == 3 and _version.minor >= 11 IS_PY312_OR_GREATER = _version.major == 3 and _version.minor >= 12 IS_PY313_OR_GREATER = _version.major == 3 and _version.minor >= 13 IS_PY314_OR_GREATER = _version.major == 3 and _version.minor >= 14 diff --git a/src/RestrictedPython/compile.py b/src/RestrictedPython/compile.py index b1a5e06..f4a66ef 100644 --- a/src/RestrictedPython/compile.py +++ b/src/RestrictedPython/compile.py @@ -79,8 +79,6 @@ def _compile_restricted_mode( c_ast = typing.cast( _T_ast_compilable, ast.parse( source, filename, mode)) - except (TypeError, ValueError) as e: - collected_errors.append(str(e)) except SyntaxError as v: collected_errors.append(syntax_error_template.format( lineno=v.lineno, diff --git a/tests/test_compile.py b/tests/test_compile.py index 379e71f..27a3ef4 100644 --- a/tests/test_compile.py +++ b/tests/test_compile.py @@ -8,7 +8,6 @@ from RestrictedPython import compile_restricted_eval from RestrictedPython import compile_restricted_exec from RestrictedPython import compile_restricted_single -from RestrictedPython._compat import IS_PY311_OR_GREATER from tests.helper import restricted_eval @@ -96,13 +95,9 @@ def test_compile__compile_restricted_exec__5(): assert result.code is None assert result.warnings == [] assert result.used_names == {} - if IS_PY311_OR_GREATER: - assert result.errors == ( - 'Line None: SyntaxError: source code string cannot contain null' - ' bytes at statement: None',) - else: - assert result.errors == ( - 'source code string cannot contain null bytes',) + assert result.errors == ( + 'Line None: SyntaxError: source code string cannot contain null' + ' bytes at statement: None',) EXEC_STATEMENT = """\ diff --git a/tests/transformer/test_try.py b/tests/transformer/test_try.py index 01b1446..a8e588e 100644 --- a/tests/transformer/test_try.py +++ b/tests/transformer/test_try.py @@ -1,7 +1,4 @@ -import pytest - from RestrictedPython import compile_restricted_exec -from RestrictedPython._compat import IS_PY311_OR_GREATER from tests.helper import restricted_exec @@ -64,10 +61,6 @@ def try_except_star(m): """ -@pytest.mark.skipif( - not IS_PY311_OR_GREATER, - reason="ExceptionGroup class was added in Python 3.11.", -) def test_RestrictingNodeTransformer__visit_TryStar__1(): """It denies try-except* PEP 654 statements.""" result = compile_restricted_exec(TRY_EXCEPT_STAR)