From 9beb94fc25bf59720f801341e843028bb542854b Mon Sep 17 00:00:00 2001 From: konstin Date: Thu, 19 Nov 2026 22:25:03 +0100 Subject: [PATCH] PEP 838: Clarifications --- peps/pep-0838.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/peps/pep-0838.rst b/peps/pep-0838.rst index 660076f5842..db706ceea49 100644 --- a/peps/pep-0838.rst +++ b/peps/pep-0838.rst @@ -71,12 +71,14 @@ Specification A new ``python-version`` field is added to ``pyvenv.cfg``. It contains a string value with the major and minor version of the Python interpreter, such as ``3.16``. The value can be obtained with -``f"{sys.version_info[0]}.{sys.version_info[1]}"``. Tools creating virtual -environments MUST write ``python-version`` to ``pyvenv.cfg``. Reading -``version`` or ``version_info`` is discouraged. +``f"{sys.version_info[0]}.{sys.version_info[1]}"``. Tools MUST write +``python-version`` to ``pyvenv.cfg`` when creating the virtual environment. +Reading ``version`` or ``version_info`` is discouraged. A Python interpreter MAY refuse to run from a virtual environment with a -mismatching ``python-version``. +mismatching ``python-version``. A mismatch between the value and the +observed version of the Python interpreter in virtual environment signals +a broken virtual environment. Rationale @@ -87,7 +89,8 @@ search