Skip to content

Allow to use the package with Python 3.12. #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 10, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12.0-alpha.5", "py312"]
- ["3.9", "docs"]
- ["3.9", "coverage"]
- ["3.9", "py39-datetime"]
Expand Down
5 changes: 2 additions & 3 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ with-pypy = false
with-docs = true
with-sphinx-doctests = true
with-windows = true
with-future-python = false
with-future-python = true
with-macos = false

[tox]
Expand All @@ -28,7 +28,6 @@ testenv-setenv = [
]
testenv-commands = [
"python -V",
"pip list",
"pytest --cov=src --cov=tests --cov-report= {posargs}",
]
testenv-additional = [
Expand Down Expand Up @@ -57,7 +56,7 @@ coverage-setenv = [
]

[coverage]
fail-under = 98.5
fail-under = 98.4

[isort]
additional-sources = "{toxinidir}/tests"
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Backwards incompatible changes

- Drop support for Python 3.6.

Features
++++++++

- Allow to use the package with Python 3.12 -- Caution: No security audit has
been done so far.


6.0 (2022-11-03)
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. image:: https://api.travis-ci.com/zopefoundation/RestrictedPython.svg?branch=master
:target: https://travis-ci.com/zopefoundation/RestrictedPython
.. image:: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml/badge.svg
:target: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml

.. image:: https://coveralls.io/repos/github/zopefoundation/RestrictedPython/badge.svg?branch=master
:target: https://coveralls.io/github/zopefoundation/RestrictedPython?branch=master
Expand Down Expand Up @@ -83,5 +83,5 @@ Contributing to RestrictedPython
--------------------------------

If you want to help maintain RestrictedPython and contribute, please refer to
the documentation `Contributing page
the documentation `Contributing page
<https://restrictedpython.readthedocs.io/en/latest/contributing/index.html>`_.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RestrictedPython is not a sandbox system or a secured environment, but it helps
Supported Python versions
=========================

RestrictedPython supports CPython 2.7, 3.5, 3.6, 3.7 and 3.8.
RestrictedPython supports CPython 3.7 up to 3.12.
It does _not_ support PyPy or other alternative Python implementations.

Contents
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def read(*rnames):
package_dir={'': 'src'},
install_requires=[
],
python_requires=">=3.7, <3.12",
python_requires=">=3.7, <3.13",
tests_require=tests_require,
extras_require={
'test': tests_require,
Expand Down
1 change: 1 addition & 0 deletions src/RestrictedPython/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
IS_PY38_OR_GREATER = _version.major == 3 and _version.minor >= 8
IS_PY310_OR_GREATER = _version.major == 3 and _version.minor >= 10
IS_PY311_OR_GREATER = _version.major == 3 and _version.minor >= 11
IS_PY312_OR_GREATER = _version.major == 3 and _version.minor >= 12

IS_CPYTHON = platform.python_implementation() == 'CPython'
9 changes: 8 additions & 1 deletion tests/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from RestrictedPython import compile_restricted_single
from RestrictedPython._compat import IS_PY38_OR_GREATER
from RestrictedPython._compat import IS_PY310_OR_GREATER
from RestrictedPython._compat import IS_PY312_OR_GREATER
from tests.helper import restricted_eval


Expand Down Expand Up @@ -102,7 +103,13 @@ def test_compile__compile_restricted_exec__5():
assert result.code is None
assert result.warnings == []
assert result.used_names == {}
assert result.errors == ('source code string cannot contain null bytes',)
if IS_PY312_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',)


EXEC_STATEMENT = """\
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ envlist =
py39
py310
py311
py312
docs
coverage
py39-datetime
combined-coverage

[testenv]
usedevelop = true
pip_pre = py312: true
deps =
datetime: DateTime
-cconstraints.txt
Expand All @@ -25,7 +27,6 @@ setenv =
COVERAGE_FILE=.coverage.{envname}
commands =
python -V
pip list
pytest --cov=src --cov=tests --cov-report= {posargs}
sphinx-build -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest
extras =
Expand Down Expand Up @@ -98,7 +99,7 @@ commands =
pytest --cov=src --cov=tests --cov-report= {posargs}
coverage run -a -m sphinx -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest
coverage html --ignore-errors
coverage report --ignore-errors --show-missing --fail-under=98.5
coverage report --ignore-errors --show-missing --fail-under=98.4

[coverage:run]
branch = True
Expand Down