New submission from Matthew Clapp <itsayellow+...@gmail.com>:
The docs for the venv module, EnvBuilder class, ensure_directories method, describe behavior that doesn't match what its actual behavior is, (and what the code is). I propose to update the documentation of the API to match the actual behavior. https://docs.python.org/3.9/library/venv.html#venv.EnvBuilder.ensure_directories The last sentence for ensure_directories(env_dir) reads: The directories are allowed to exist already, as long as either clear or upgrade were specified to allow operating on an existing environment directory. After testing and looking at the code (including past commits back over 6 years), this is not true. ensure_directories completely disregards the `upgrade` attribute. Also it allows directories to exist already unconditionally (always operating without error), whether the `clear` attribute is set or not. In addition, if `clear` is not set, it doesn't make any changes to the directories, but helpfully still returns the context of venv paths. Ref: https://github.com/python/cpython/blob/3ce35bfbbe29664942f9a8c50c177a4575a31934/Lib/venv/__init__.py#L95 ---------- assignee: docs@python components: Documentation messages: 395603 nosy: docs@python, itsayellow priority: normal severity: normal status: open title: venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44388> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com