Skip to content

Commit e750331

Browse files
committed
readd Python 3.9 support
1 parent 3533c0f commit e750331

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
config:
2626
# [Python version, tox env]
2727
- ["3.14", "release-check"]
28+
- ["3.9", "py39"]
2829
- ["3.10", "py310"]
2930
- ["3.11", "py311"]
3031
- ["3.12", "py312"]

.meta.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ testenv-additional = [
4747
" coverage combine",
4848
" coverage html",
4949
" coverage report -m --fail-under=100",
50-
"depends = py310,py311,py312,py313,py314,py314-datetime,coverage",
50+
"depends = py39,py310,py311,py312,py313,py314,py314-datetime,coverage",
5151
]
5252
coverage-command = "pytest --cov=src --cov=tests --cov-report= tests {posargs}"
5353
coverage-setenv = [

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def read(*rnames):
6161
packages=find_packages('src'),
6262
package_dir={'': 'src'},
6363
install_requires=[],
64-
python_requires=">=3.10, <3.15",
64+
python_requires=">=3.9, <3.15",
6565
extras_require={
6666
'test': ['pytest', 'pytest-mock'],
6767
'typecheck': ['mypy', 'typeshed'],

src/RestrictedPython/compile.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import ast
24
import warnings
35
from ast import Expression
@@ -8,15 +10,20 @@
810
from os import PathLike
911
from typing import Any
1012
from typing import Literal
11-
from typing import TypeAlias
1213

1314
from RestrictedPython._compat import IS_CPYTHON
15+
from RestrictedPython._compat import IS_PY310_OR_GREATER
1416
from RestrictedPython.transformer import RestrictingNodeTransformer
1517

1618

17-
# Temporary workaround for missing _typeshed
18-
ReadableBuffer: TypeAlias = bytes | bytearray
19+
if IS_PY310_OR_GREATER:
20+
from typing import TypeAlias
1921

22+
# Temporary workaround for missing _typeshed
23+
ReadableBuffer: TypeAlias = bytes | bytearray
24+
else:
25+
from typing_extensions import TypeAlias # type: ignore[import]
26+
ReadableBuffer: TypeAlias = bytes | bytearray # type: ignore[no-redef]
2027

2128
CompileResult = namedtuple(
2229
'CompileResult', 'code, errors, warnings, used_names')

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ minversion = 3.18
55
envlist =
66
release-check
77
lint
8+
py39
89
py310
910
py311
1011
py312

0 commit comments

Comments
 (0)