Backport Python 3.11 support (close RHBZ#2098675)
- Backport the fix for upstream bug T99277 “Fails to compile on Python
3.11b3 due to opaque PyFrameObject”, along with a related commit
improving support for Python releases newer than 3.7.
- Add an additional patch required for Python 3.11b3 but not for later
Python 3.11 pre-releases. This is downstream-only for now, but the
concept was suggested upstream as a potential general improvement.