Documentation for a newer release is available. View Latest

Python

Python 3.11

Fedora 37 proporciona la pila Python en versión 3.11, superior a la versión 3.10 en el lanzamiento anterior. Los cambios más notables incluyen:

  • Grupos de Excepción y except*

  • Ubicaciones de errores mejoradas en los rastreos

  • Soporte para el análisis TOML en la librería estándar

  • Una gran mejora de la velocidad en comparación con Python 3.10

Funciones de escritura:

  • Genéricos variados

  • Marcar elementos individuales TypedDict como necesarios o potencialmente desaparecidos

  • Autotipo

  • Arbitrary literal string type

  • Dataclass transforms

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 -sP. The -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:

  • %{py3_shbang_opts}

  • %{py3_shbang_opts_nodash}

  • %{py3_shebang_flags}

  • %{py_shbang_opts}

  • %{py_shbang_opts_nodash}

  • %{py_shebang_flags}

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.