Fedora 37 provides the Python stack in version 3.11, up from version 3.10 in the previous release. Notable changes include:
Exception Groups and
Enhanced error locations in tracebacks
Support for parsing TOML in the standard library
A massive speed improvement compared to Python 3.10
TypedDictitems as required or potentially-missing
Arbitrary literal string type
For a full list of changes, see the What’s New In Python 3.11 upstream document. Also see Porting to Python 3.11 if you have Python programs running on an older version.
Add -P to default shebangs
All Python 3 shebang RPM macros in Fedora 37 have been changed to contain one more flag:
-P. Previously, they contained
-s, now they contain
-P flag was introduced in Python 3.11.
The new flag stops Python from prepending a potentially unsafe path to
sys.path. This causes Python programs in
/usr/bin to be less fragile towards random files present in the same directory, making debugging certain types of issues easier and enhancing security.
The following RPM macros are affected by this change:
For a detailed explanation of what this change means, a list of affected packages, and information on how to opt out of this change (or explicitly opt in) if needed, see the Fedora Wiki.
Want to help? Learn how to contribute to Fedora Docs ›