Windows: python.exe fails to start from a long path because of DLL manifests
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 28/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- build-system
Línea de trabajo
Read PC/python_nt.rc and PC/sqlite3.rc, then inspect the executable resource scripts to compare how manifests are embedded. The proposed change removes the ID 2 manifest resource and its fallback define from the two DLL resource scripts; keep the executable manifests at ID 1. Done means DLLs no longer embed that manifest while the executables retain theirs, and long-path startup and extension imports work on Windows.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug report
Problem
python.exe fails to start with STATUS_NAME_TOO_LONG once its path is 247 characters or longer, even with LongPathsEnabled=1. It turns out this is actually from loading the DLL, not from python.exe itself.
Extension modules like _ctypes and _ssl also fail to import when the install is at a long path.
Cause
The build is creating DLLs with a manifest, and as noted in #126929, Windows can't load a DLL with an embedded manifest from a path near MAX_PATH.
Since about 2010, the manifest doesn't do anything in a DLL. Windows takes the supported OS versions and the Common Controls dependency from the EXE's manifest, not a DLL's.
History
DLLs used to need a manifest. With Visual C++ 2008, which Python 2.6 through 3.2 were built with, a DLL had to declare its dependency on the C runtime in an embedded manifest to find it. However, Visual C++ 2010 stopped using manifests to find the C runtime, so DLLs haven't needed one since.
#67207 (bpo-23018) added the manifest to python_nt.rc in 2015, at the same time as the one for python[w].exe, to declare supportedOS so that GetVersion would stop reporting Windows 8 on newer versions.
In 2016, #71496 (bpo-27309) added the Common Controls dependency so that tkinter's native dialogs would get the right styles. From that change: "Windows needs to load a different version of a particular DLL for the entire process." However, that's only information that the process needs, not the DLLs.
#71918 (bpo-27731) added longPathAware later that year.
Where the manifest comes from now
PC/python_nt.rc embeds PC/python.manifest as resource ID 2, and pythoncore, python3dll, and every extension module project in PCbuild use that resource script. PC/sqlite3.rc does the same for sqlite3.dll.
Possible Solution
Remove the 2 RT_MANIFEST "python.manifest" line, and the RT_MANIFEST fallback define above it, from PC/python_nt.rc and PC/sqlite3.rc. python_exe.rc and pythonw_exe.rc keep embedding the manifest as ID 1.
Note: #156759 doesn't help here, because Windows loads python3XY.dll as a static import of python.exe, before any Python code runs.
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Linked PRs
- gh-160626
- Lenguaje dominante
- Python
- Estrellas
- 77.7k
- Forks
- 38.3k
- Merge medio
- 12 h 27 min
- PR fusionados (30 d)
- 710
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
-
3.16 build type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
python/cpython#160829 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
dependencies infra topic-ensurepip
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
symtable: repr() of a Symbol raises TypeError under -X lazy_imports=allPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertostdlib topic-lazy-imports type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
python/cpython#160810 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
tarfile: extractfile(member).read() of a sparse member is slow due to repeated bytes concatenationAbiertoperformance stdlib triaged type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
python/cpython#160774 · 2 comentarios ·
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
Todos los issues de python/cpython
Issues similares
-
area/profiles comp/cli P3 type/feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
NousResearch/hermes-agent#146372 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
[oblt-aw][autodoc] Document obs-aw-automerge contract and fix automerge doc inconsistenciesPosiblemente ocupada @github-actions la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
GeoSeries scale and skew tests fail with pytest 9.2.0Posiblemente ocupada @jiayuasu la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
admission-deferred priority: medium status: ready work-class: scoped
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
melodic-software/claude-code-plugins#10887 · 4 comentarios ·
Los mantenedores suelen responder en 1 día