Skip to content

Commit 27e4b60

Browse files
committed
Issue #16519: Used os.path.abspath, removed unnecessary code for executable_name.
1 parent 44dcd6b commit 27e4b60

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Lib/site.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,15 +503,13 @@ def venv(known_paths):
503503
executable = os.environ['__PYVENV_LAUNCHER__']
504504
else:
505505
executable = sys.executable
506-
executable_dir, executable_name = os.path.split(executable)
507-
site_prefix = os.path.dirname(executable_dir)
506+
exe_dir, _ = os.path.split(os.path.abspath(executable))
507+
site_prefix = os.path.dirname(exe_dir)
508508
sys._home = None
509-
if sys.platform == 'win32':
510-
executable_name = os.path.splitext(executable_name)[0]
511509
conf_basename = 'pyvenv.cfg'
512510
candidate_confs = [
513511
conffile for conffile in (
514-
os.path.join(executable_dir, conf_basename),
512+
os.path.join(exe_dir, conf_basename),
515513
os.path.join(site_prefix, conf_basename)
516514
)
517515
if os.path.isfile(conffile)

0 commit comments

Comments
 (0)