python / python/cpython

__file__ for Some Dynamic Extension Modules has a Broken Refcount

Abierto
#118,733 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

3.13 interpreter-core type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
36k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

Bug report

Bug description:

In gh-118532 I was getting crashes when the _testsinglephase module's cached copy of __dict__ was finalized. I worked around it in that PR by doing an unconditional incref, but that introduced a refleak for other cases. At the time, I wasn't able to determine if gh-118532 was the source of the refcount problem or if it only exposed an existing problem.

While working on gh-118157 I narrowed the problem down to the __file__ value in the cached __dict__ and resolved it by interning the string. However, the underlying problem remains: somewhere along the line there seems to be a missing incref.

That needs to be located and fixed, and then the interning can be dropped.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Lee primero gh-118532 y gh-118157, centrándote en _testsinglephase, el dict en caché y su valor file. Reproduce el fallo de refcount en la rama main de CPython, rastrea dónde falta el incref y confirma que el fix funciona sin el refleak del workaround, de modo que se pueda eliminar el interning.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Error
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.