[Bug]: sys.flags.debug is 1 whenever optimization is off
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
- 75/100
Línea de trabajo
El valor incorrecto proviene del argumento debug en SysModuleBuiltins.java (alrededor de la línea 697), que se deriva de PythonOptions.PythonOptimizeFlag. Lee cómo se establecen los demás campos de sys.flags allí, luego ejecuta el fragmento del reporte para ver sys.flags.debug y subprocess._args_from_interpreter_flags(). Está terminado cuando sys.flags.debug es 0 por defecto y no se emite ningún -d, mientras que optimize y __debug__ se mantienen como están.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
sys.flags.debug is 1 whenever optimization is off. In CPython it is 0 unless the interpreter was started with -d (parser debug output), regardless of -O.
sys.flags is built in SysModuleBuiltins with debug derived from the optimize option:
PInt.intValue(!language.getEngineOption(PythonOptions.PythonOptimizeFlag)), // debug
This looks like debug being conflated with __debug__.
The visible effect: subprocess._args_from_interpreter_flags() emits -d for every non-optimized run, so anything that re-executes sys.executable with the current interpreter flags passes -d. The most common case is multiprocessing with the spawn start method. An embedder whose python.Executable does not accept -d then fails to start the child, and the parent gets EOFError from Connection.recv().
Operating system
Linux
CPU architecture
x86_64
GraalPy version
25.x, embedded through the polyglot API. The line above is unchanged on current master.
JDK version
GraalVM JDK 25
Context configuration
Default options; python.PythonOptimizeFlag not set.
Steps to reproduce
import sys, subprocess
print(sys.flags.debug, sys.flags.optimize, __debug__)
print(subprocess._args_from_interpreter_flags())
Expected behavior
As on CPython 3.12 with no flags:
0 0 True
[]
Actual:
1 0 True
['-d']
(plus whatever other flags are configured).
Stack trace
None. The symptom shows up downstream, e.g. a spawned multiprocessing child exits during argument parsing and the parent raises EOFError.
Additional context
A fix would be to report debug as 0 (GraalPy has no -d equivalent), or to back it with a dedicated option if one is wanted. optimize and __debug__ are already correct.
- Lenguaje dominante
- Python
- Estrellas
- 1.7k
- Forks
- 158
- Merge medio
- 9 h 12 min
- PR fusionados (30 d)
- 50
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
- Sin 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 oracle/graalpython
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
oracle/graalpython#1105 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
oracle/graalpython#1102 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
oracle/graalpython#1217 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
oracle/graalpython#1212 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: incompatible (wrt CPython int's) processing of strings by int() constructor with spacesAbiertobug
Dificultad 3/5 Medio día Aptitud para principiantes 50/100
oracle/graalpython#1209 ·
Los mantenedores suelen responder en 1 día
Todos los issues de oracle/graalpython
Issues similares
-
docs: the dev-setup table and AGENTS.md name the reviewed_by guard that CI's Changelog job runsAbiertoarea: tools documentation good first issue ready for a contributor
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
eyalgolan/statecraft-israel#873 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add cover art to song rowsAbiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 5 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día