Skip to content

source venv/bin/activate returns non-zero on systems with hashing disabled #149701

@genericallyterrible

Description

@genericallyterrible

Bug report

Bug description:

After creating a venv with python -m venv .venv, attempting to source .venv/bin/activate on a system with hashing disabled successfully activates the venv, but returns non-zero.

bash-5.3$ set +h
bash-5.3$ hash
bash: hash: hashing disabled
bash-5.3$ python -m venv .venv
bash-5.3$ source .venv/bin/activate
(.venv) bash-5.3$ echo $?
1

This can make it appear that there was an error sourcing activate when there wasn't, especially for styled prompts that can color code based on command success such as starship.

Image

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-venvRelated to the venv moduletype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions