Creating a venv can run a local ensurepip.py
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by reproducing the report with the supplied script on a tested CPython version, then trace how venv invokes ensurepip during environment creation. The issue links PR gh-160282, indicating work is already underway; the desired result is that a local .venv/ensurepip.py is not executed across the listed cases.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug report
When you run python -m venv .venv, and .venv/ensurepip.py already exists, the file gets run.
Repro script:
import os
from pathlib import Path
import subprocess
import sys
from tempfile import TemporaryDirectory
with TemporaryDirectory() as name:
root = Path(name)
home = root / "private"
home.mkdir(mode=0o700)
env = {k: v for k, v in os.environ.items() if not k.startswith("PYTHON")}
env["PIP_NO_INDEX"] = "1"
cases = [
("normal", [], [], True),
("isolated", ["-I"], [], True),
("without-pip", ["-I"], ["--without-pip"], False),
("clear-regular-directory", ["-I"], ["--clear"], False),
]
if len(sys.argv) > 1:
cases.append(("vscode", ["-I"], [], True))
for case, interpreter_options, venv_options, expected in cases:
project = root / case
target = project / ".venv"
target.mkdir(parents=True)
marker = home / case
(target / "ensurepip.py").write_text(
"import os, runpy, sys\n"
"from pathlib import Path\n"
f"Path({str(marker)!r}).write_text('bootstrap executed')\n"
"sys.path[:] = [s for s in sys.path if os.path.realpath(s) != os.getcwd()]\n"
"runpy.run_module('ensurepip', run_name='__main__')\n"
)
if case == "vscode":
arguments = [str(Path(sys.argv[1]).resolve())]
else:
arguments = ["-m", "venv", *venv_options, ".venv"]
command = [sys.executable, *interpreter_options, *arguments]
subprocess.run(command, env=env, cwd=project, check=True, timeout=90)
print(case, "marker", marker.exists(), flush=True)
assert marker.exists() is expected
CPython versions tested on:
3.12, 3.13, CPython main branch
Operating systems tested on:
macOS, Linux
Linked PRs
- gh-160282
- Lenguaje dominante
- Python
- Estrellas
- 77.7k
- Forks
- 38.3k
- Merge medio
- 13 h 30 min
- PR fusionados (30 d)
- 708
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python/cpython
-
tarfile: extractfile(member).read() of a sparse member is slow due to repeated bytes concatenationAbiertoperformance stdlib
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
tests topic-profiling type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
python/cpython#160334 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
`iso2022_jp_3` encodes U+9B1D but decodes the result as U+9B1CPosiblemente ocupada @kinqsradio la tomó hace 1 día. Abiertoextension-modules type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Remove unused FVS_* macrosAbiertointerpreter-core type-feature
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
python/cpython#160109 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
extension-modules type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
python/cpython#160001 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de python/cpython
Issues similares
-
filesystem: `file://C:/...` bucket_url is read as a UNC share named `C:` and silently lists no filesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
comp/desktop desktop/shell os/windows P3 tool/file type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
NousResearch/hermes-agent#145928 ·
Los mantenedores suelen responder en 1 día
-
integration:coding-agents
Dificultad 1/5 Menos de una hora Aptitud para principiantes 83/100
vectorize-io/hindsight#6151 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FormalLanguageConstrainedPathQuerying/FLPQ_Data#174 ·
Los mantenedores suelen responder en 1 día
-
[VLM] granite_vision preset produces empty output and runs ~3× slower with Granite Vision 3.3-2B than with Granite Vision 4.1-4BPosiblemente ocupada @prassu017 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
docling-project/docling#5068 · 4 comentarios ·
Los mantenedores suelen responder en 1 día