bpo-34977: Use venv redirector instead of original python.exe on Windows (GH-11029)
diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst
index 7058d3a..efa51e2 100644
--- a/Doc/library/venv.rst
+++ b/Doc/library/venv.rst
@@ -130,7 +130,6 @@
.. versionadded:: 3.6
Added the ``prompt`` parameter
-
Creators of third-party virtual environment tools will be free to use the
provided ``EnvBuilder`` class as a base class.
@@ -177,16 +176,15 @@
.. method:: setup_python(context)
- Creates a copy of the Python executable (and, under Windows, DLLs) in
- the environment. On a POSIX system, if a specific executable
- ``python3.x`` was used, symlinks to ``python`` and ``python3`` will be
- created pointing to that executable, unless files with those names
- already exist.
+ Creates a copy of the Python executable in the environment on POSIX
+ systems. If a specific executable ``python3.x`` was used, symlinks to
+ ``python`` and ``python3`` will be created pointing to that executable,
+ unless files with those names already exist.
.. method:: setup_scripts(context)
Installs activation scripts appropriate to the platform into the virtual
- environment.
+ environment. On Windows, also installs the ``python[w].exe`` scripts.
.. method:: post_setup(context)
@@ -194,6 +192,11 @@
implementations to pre-install packages in the virtual environment or
perform other post-creation steps.
+ .. versionchanged:: 3.7.2
+ Windows now uses redirector scripts for ``python[w].exe`` instead of
+ copying the actual binaries, and so :meth:`setup_python` does nothing
+ unless running from a build in the source tree.
+
In addition, :class:`EnvBuilder` provides this utility method that can be
called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to
assist in installing custom scripts into the virtual environment.
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 8b9b64f..3e94a61 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -2512,3 +2512,13 @@
when provided with input that does not have a trailing new line. This behavior
now matches what the C tokenizer does internally.
(Contributed by Ammar Askar in :issue:`33899`.)
+
+Notable changes in Python 3.7.2
+===============================
+
+In 3.7.2, :mod:`venv` on Windows no longer copies the original binaries, but
+creates redirector scripts named ``python.exe`` and ``pythonw.exe`` instead.
+This resolves a long standing issue where all virtual environments would have
+to be upgraded or recreated with each Python update. However, note that this
+release will still require recreation of virtual environments in order to get
+the new scripts.