From b25f60210dcca6179482e34454b636604addc274 Mon Sep 17 00:00:00 2001 From: Cycloctane Date: Sun, 27 Jul 2025 14:47:31 +0800 Subject: [PATCH 1/4] Remove lib64->lib symlink in venv directory --- Lib/venv/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index dc9c5991df7e1c..e5addcc393a1b9 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -174,6 +174,7 @@ def create_if_needed(d): context.python_exe = exename binpath = self._venv_path(env_dir, 'scripts') libpath = self._venv_path(env_dir, 'purelib') + platlibpath = self._venv_path(env_dir, 'platlib') # PEP 405 says venvs should create a local include directory. # See https://peps.python.org/pep-0405/#include-files @@ -191,12 +192,8 @@ def create_if_needed(d): create_if_needed(incpath) context.lib_path = libpath create_if_needed(libpath) - # Issue 21197: create lib64 as a symlink to lib on 64-bit non-OS X POSIX - if ((sys.maxsize > 2**32) and (os.name == 'posix') and - (sys.platform != 'darwin')): - link_path = os.path.join(env_dir, 'lib64') - if not os.path.exists(link_path): # Issue #21643 - os.symlink('lib', link_path) + context.platlib_path = platlibpath + create_if_needed(platlibpath) context.bin_path = binpath context.bin_name = os.path.relpath(binpath, env_dir) context.env_exe = os.path.join(binpath, exename) From f13b10fff8bfe52cb50b026e3564f5ade29db071 Mon Sep 17 00:00:00 2001 From: Cycloctane Date: Sun, 27 Jul 2025 15:43:32 +0800 Subject: [PATCH 2/4] fix test --- Lib/test/test_venv.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py index 3c18c9c2900ad7..e482f6eda46f54 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -138,14 +138,9 @@ def _check_output_of_default_create(self): self.isdir(self.bindir) self.isdir(self.include) self.isdir(*self.lib) - # Issue 21197 p = self.get_env_file('lib64') - conditions = ((struct.calcsize('P') == 8) and (os.name == 'posix') and - (sys.platform != 'darwin')) - if conditions: - self.assertTrue(os.path.islink(p)) - else: - self.assertFalse(os.path.exists(p)) + if os.path.exists(p): + self.assertFalse(os.path.islink(p)) data = self.get_text_file_contents('pyvenv.cfg') executable = sys._base_executable path = os.path.dirname(executable) From de3165eaef2b6e0806311a0a0a178255424a6c1e Mon Sep 17 00:00:00 2001 From: Cycloctane Date: Sun, 27 Jul 2025 15:52:01 +0800 Subject: [PATCH 3/4] remove unused import --- Lib/test/test_venv.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py index e482f6eda46f54..d46b45e54370b1 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -12,7 +12,6 @@ import pathlib import re import shutil -import struct import subprocess import sys import sysconfig From 23fed55d5fb1ca6e8ae2056f9bfe69f85d663378 Mon Sep 17 00:00:00 2001 From: Cycloctane Date: Sun, 27 Jul 2025 17:04:04 +0800 Subject: [PATCH 4/4] add news --- .../next/Library/2025-07-27-17-03-17.gh-issue-133951.7kwt78.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-07-27-17-03-17.gh-issue-133951.7kwt78.rst diff --git a/Misc/NEWS.d/next/Library/2025-07-27-17-03-17.gh-issue-133951.7kwt78.rst b/Misc/NEWS.d/next/Library/2025-07-27-17-03-17.gh-issue-133951.7kwt78.rst new file mode 100644 index 00000000000000..dfda8e8f10ccf5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-07-27-17-03-17.gh-issue-133951.7kwt78.rst @@ -0,0 +1,2 @@ +Remove lib64-lib symlink creation when creating new virtual environments in +:mod:`venv` module