Repository: zopefoundation/RestrictedPython (language: python)

Issue:
Support Python 3.11
Look through the change log of Python 3.11 (once the final version is released) for potential issues which need to be handled by RestrictedPython to prevent access to otherwise forbidden data/objects.

There is no need to support new language features of Python 3.11 right now, let's see how they evolve when started being used.

Open tasks:

- [X] make package installable and fix tests (#223)
- [X] cut an alpha dev release (5.3a1.dev0)
- [x] drop Python 2 support (and Python 3.5) for a sane Python 3.11 support (See #223 for details)
- [x] look through the change log of the final Python 3.11.0 version for potential changes allowing to bypass restrictions #243



Discussion / hints:
@icemac why keep Python 3.6 support? It is already End of life (https://devguide.python.org/versions/)  

I am at the PloneConf and would like to make RestrictedPython 6.0 ready for shipping / maybe a release-candidate package on pypi so that the others could check and test Plone for Python 3.11 support. 
I guess everything should be in the master branch? I did have a look and do not see all Python 2 support dropped there. 

Any suggestions what to do and look at?
@loechel We already have a dev release at https://pypi.org/project/RestrictedPython/6.0a1.dev0/ to test against Python 3.11. (Zope 5.dev is already using that version on Python 3.11.)

I decided to keep Python 3.6 support like it is the current policy for zopefoundation projects dropping Python 2.7 and 3.5 support. Plus keeping it makes no harm.

If you found Python 2 support code: Please create a PR to remove it.

Fix patch:
diff --git a/.meta.toml b/.meta.toml
index bb6c073..a7903ca 100644
--- a/.meta.toml
+++ b/.meta.toml
@@ -2,7 +2,7 @@
 # https://github.com/zopefoundation/meta/tree/master/config/pure-python
 [meta]
 template = "pure-python"
-commit-id = "b5df3766ff8923477f3d24729b19504f0c401a2e"
+commit-id = "70229255d495a945324228b50ee735cc75e01430"
 
 [python]
 with-pypy = false
@@ -10,7 +10,7 @@ with-legacy-python = false
 with-docs = true
 with-sphinx-doctests = true
 with-windows = true
-with-future-python = true
+with-future-python = false
 
 [tox]
 use-flake8 = true
diff --git a/CHANGES.rst b/CHANGES.rst
index 8203ff8..29bec8c 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -12,10 +12,7 @@ Backwards incompatible changes
 Features
 ++++++++
 
-- Allow to use the package with Python 3.11 -- Caution: No security audit has
-  been done so far.
-
-- Fix code to run on Python 3.11.0b3.
+- Officially support Python 3.11.
 
 
 5.2 (2021-11-19)
diff --git a/setup.py b/setup.py
index 1c01ad5..11c6e98 100644
--- a/setup.py
+++ b/setup.py
@@ -47,12 +47,12 @@ def read(*rnames):
         'Programming Language :: Python',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3 :: Only',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
         'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
         'Programming Language :: Python :: Implementation :: CPython',
         'Topic :: Security',
     ],
diff --git a/tox.ini b/tox.ini
index 3226a98..e338d78 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,12 +17,10 @@ envlist =
 
 [testenv]
 usedevelop = true
-pip_pre = py311: true
 deps =
     datetime: DateTime
     -cconstraints.txt
     pytest-cov
-    Sphinx
 setenv =
     COVERAGE_FILE=.coverage.{envname}
 commands =
@@ -91,7 +89,6 @@ deps =
     datetime: DateTime
     -cconstraints.txt
     pytest-cov
-    Sphinx
 setenv =
     COVERAGE_FILE=.coverage
 commands =


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 14244e4..ac63f03 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -27,7 +27,7 @@ jobs:
         - ["3.8",   "py38"]
         - ["3.9",   "py39"]
         - ["3.10",  "py310"]
-        - ["3.11.0-rc.2",  "py311"]
+        - ["3.11",  "py311"]
         - ["3.9",   "docs"]
         - ["3.9",   "coverage"]
         - ["3.9",   "py39-datetime"]