You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
venv --clear deletes symlink target contents before rejecting the symlink #158068
ensure_directories() already refuses a symlinked or file-backed env_dir — but only in create_if_needed(), which runs after the clear step. With --clear / clear=True, the clear happens first and follows the symlink:
ifos.path.exists(env_dir) andself.clear: # exists() follows the symlink -> Trueself.clear_directory(env_dir) # listdir() follows it -> wipes the TARGET's contents
...
create_if_needed(env_dir) # only now raises ValueError for the symlink
So if env_dir is a symlink to a real directory, clear_directory() deletes that directory's contents before venv rejects the path. This contradicts venv's own contract, which is to reject symlinked/file env_dir rather than act on it.
Activity