[Bug]: sys.flags.debug is 1 whenever optimization is off
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 75/100
Direção de pesquisa
O valor incorreto vem do argumento debug em SysModuleBuiltins.java (por volta da linha 697), que é derivado de PythonOptions.PythonOptimizeFlag. Leia como os outros campos de sys.flags são definidos ali e, em seguida, execute o trecho do relatório para ver sys.flags.debug e subprocess._args_from_interpreter_flags(). Está concluído quando sys.flags.debug é 0 por padrão e nenhum -d é emitido, enquanto optimize e __debug__ permanecem como estão.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 1.7k
- Forks
- 158
- Merge médio
- 8h 15min
- PRs com merge (30d)
- 49
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de oracle/graalpython
-
[Bug]: `reversed()` on a dict or dict view returns the forward iterator type instead of `dict_reverse*iterator`Talvez já em andamento @jseop-lim assumiu há 2 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
oracle/graalpython#1226 ·
Mantenedores costumam responder em até 1 dia
-
[Bug]: `complex(real, imag)` converts `imag` before rejecting a non-number `real`Talvez já em andamento @jseop-lim assumiu há 2 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
oracle/graalpython#1225 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
oracle/graalpython#1105 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
oracle/graalpython#1102 ·
Mantenedores costumam responder em até 1 dia
-
[Bug]: `compile()` with unrecognised flags raises a `ValueError` whose message crashes with `NullPointerException`Talvez já em andamento @jseop-lim assumiu há 2 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
oracle/graalpython#1231 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de oracle/graalpython
Issues semelhantes
-
infrastructure
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
khuisman/mcp-gee-sweet#1152 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
backroom bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ditto-assistant/ditto-subnet#3069 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
open-webui/open-webui#32901 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
0.3.3 bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia