[Bug]: sys.flags.debug is 1 whenever optimization is off
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
調査の方向性
誤った値は SysModuleBuiltins.java(697行目付近)の debug 引数から来ており、これは PythonOptions.PythonOptimizeFlag から導出されています。そこで sys.flags の他のフィールドがどのように設定されているかを読み、そのうえでレポートのスニペットを実行して sys.flags.debug と subprocess._args_from_interpreter_flags() を確認してください。sys.flags.debug がデフォルトで 0 になり、-d が出力されなくなり、optimize と __debug__ は現状のままであれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 158
- 平均マージ
- 8時間 31分
- マージ済み PR(30日)
- 55
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
oracle/graalpython のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
oracle/graalpython#1105 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oracle/graalpython#1102 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
oracle/graalpython#1212 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 半日 初心者へのやさしさ 50/100
oracle/graalpython#1209 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 44/100
oracle/graalpython#1198 ·
メンテナーはふだん 1 日以内に返信
oracle/graalpython の issue をすべて見る
似ている issue
-
`burr` fails to start when the Python path has a space in it対応中かも @enekoreto が今日担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 5 日以内に返信
-
gemini 出现了新的域名需要加入オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
難易度 2/5 半日 初心者へのやさしさ 72/100
debpalash/VoiceStudio#2903 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dagster-io/community-integrations#367 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
aws-samples/sample-per-model-bedrock#243 ·
メンテナーはふだん 1 日以内に返信