Skip to content

The search for pyvenv.cfg doesn't match PEP 405 #77483

Description

@mattheww
mannequin
BPO 33302
Nosy @mattheww

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2018-04-17.21:48:27.965>
labels = ['interpreter-core', 'type-bug', '3.7']
title = "The search for pyvenv.cfg doesn't match PEP 405"
updated_at = <Date 2018-04-17.21:48:27.965>
user = 'https://github.com/mattheww'

bugs.python.org fields:

activity = <Date 2018-04-17.21:48:27.965>
actor = 'mattheww'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Interpreter Core']
creation = <Date 2018-04-17.21:48:27.965>
creator = 'mattheww'
dependencies = []
files = []
hgrepos = []
issue_num = 33302
keywords = []
message_count = 1.0
messages = ['315424']
nosy_count = 1.0
nosy_names = ['mattheww']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue33302'
versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

Activity

  1. mattheww commented on Apr 17, 2018

    matthewwmannequin
    MannequinAuthor

    PEP-405 says that the pyvenv.cfg file is found as follows:

    « a pyvenv.cfg file is found either adjacent to the Python executable or one directory above it (if the executable is a symlink, it is not dereferenced), »

    But in cpython if the executable is a symlink, it _is_ dereferenced before searching for pyvenv.cfg .

    I've checked this behaviour with Python 3.5, 3.6, and today's 3.7 tip.

    Looking in 3.7's getpath.c, calculate_path_impl() calls, in order:

       calculate_program_full_path()
       calculate_argv0_path()
       calculate_read_pyenv()

    It looks like the symlink resolution happens near the end of calculate_argv0_path().

    I think this means that the 'home=' line in pyvenv.cfg files generated by the 'venv' module is irrelevant (and seems likely to confuse anyone who might try to construct a Python environment by imitating a built venv).

  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-bugAn unexpected behavior, bug, or error
    on Apr 17, 2018
  3. transferred this issue fromon Apr 10, 2022
  4. mattheww commented on Sep 6, 2026

    @mattheww
    Author

    I think this was fixed by #29041 (for Python 3.11) and Python now behaves as PEP 405 said it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions