GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sys.executable can be a relative path contrary to documented behavior [3.11 regression] · Issue #154160 · python/cpython Open Labels extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:When
Context: I have a script that uses a custom virtualenv for dependencies that invokes itself in a different working directory. Because import sys, subprocess; subprocess.run([sys.executable, "--version"], cwd="/tmp") Alternative reproducer that reveals the issue: $ python3 -m venv venv && PATH="venv/bin:$PATH" python3 -c 'import sys;print(sys.executable, sys.version.split()[0])' <frozen site>:101: RuntimeWarning: Unexpected value in sys.prefix, expected /home/arch/venv, got venv <frozen site>:101: RuntimeWarning: Unexpected value in sys.exec_prefix, expected /home/arch/venv, got venv venv/bin/python3 3.14.6 This used to work in Python 3.10 and before, and is broken in Python 3.11 (2022) up to at least 3.14.6 and 3.15.0b3. I used this reproducer to confirm: Another mild regression is the presence of an extra leading slash when using a relative path from the root directory: $ podman run --rm python:3.15-rc-slim usr/local/bin/python3 -c 'import sys;print(sys.executable, sys.version.split()[0])' //usr/local/bin/python3 3.15.0b3 $ podman run --rm python:3.10-slim usr/local/bin/python3 -c 'import sys;print(sys.executable, sys.version.split()[0])' /usr/local/bin/python3 3.10.20 I suspect that both regressions have something to do with the refactoring done in https://bugs.python.org/issue45582 (#29041 by @zooba). CPython versions tested on:3.15, 3.14, 3.13, 3.12, 3.11 Operating systems tested on:Linux Linked PRsActivity
MetadataMetadataAssigneesLabelsextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |