Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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/
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.installed.cfg
.mr.developer.cfg
.tox/
.venv
.vscode/
__pycache__/
bin/
Expand All @@ -30,4 +31,5 @@ parts/
pyvenv.cfg
share/
testing.log
uv.lock
var/
2 changes: 1 addition & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes
8.6 (unreleased)
----------------

- Drop support for Python 3.10.

- Remove ``bytes``, ``sorted``, ``tuple`` and ``zip`` from ``safe_builtins``
and do not add ``reversed``: all of them iterate their argument in C,
bypassing the ``_getiter_`` guard. Applications which need them have to
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -28,7 +27,7 @@ classifiers = [
"Typing :: Typed",
]
dynamic = ["readme"]
requires-python = ">=3.10, <3.16"
requires-python = ">=3.11,<3.16"
authors = [
{name = "Zope Foundation and contributors",email = "zope-dev@zope.dev"},
]
Expand Down
1 change: 0 additions & 1 deletion src/RestrictedPython/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/RestrictedPython/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 3 additions & 8 deletions tests/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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 = """\
Expand Down
7 changes: 0 additions & 7 deletions tests/transformer/test_try.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ minversion = 3.18
envlist =
release-check
lint
py310
py311
py312
py313
Expand All @@ -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
Expand Down Expand Up @@ -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
Loading