Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

nonsensical TypeError from "-X jit -m compile --static"

オープン
#86 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
compilers

調査の方向性

cinder_typed_prim_bug.py から始め、-X jit -m compiler --static を付けた Docker コマンドで失敗を再現してください。static.double プリミティブを使用する呼び出しについて、compiler/main.py からコンパイラの経路を追跡し、動作するコマンドの場合と比較してください。例が正常に実行され、TypeError なしで期待される結果を出力すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

sp-correctness staticpython

good (no options):

$ docker run -v $PWD:/vol -it --rm ghcr.io/facebookincubator/cinder-runtime:cinder-3.8 vol/cinder_typed_prim_bug.py
done 0.57

bad (-X jit -m compile --static):

$ docker run -v $PWD:/vol -it --rm ghcr.io/facebookincubator/cinder-runtime:cinder-3.8 -X jit -m compiler --static vol/cinder_typed_prim_bug.py
Traceback (most recent call last):
  File "/cinder/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/cinder/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/cinder/lib/python3.8/compiler/__main__.py", line 122, in <module>
    exec(codeobj, d, d)
  File "vol/cinder_typed_prim_bug.py", line 15, in __main__
    main()
  File "vol/cinder_typed_prim_bug.py", line 10, in main
    c += foo(.4, .97)
TypeError: unsupported operand type(s) for +=: 'float' and 'function'

The compiler is acting as if the written code were c += foo rather than c += foo(.4, .97).

The problem goes away by removing -X jit, --static, or use of the double primitives.

cinder_typed_prim_bug.py

from __static__ import double

def foo(a: double, b: double) -> double:
    return b - a

def main():
    c = 0.
    c += foo(.4, .97)
    print('done', c)

if __name__ == '__main__':
    main()

seen in cinder-3.8.6c2de94

主要言語
Python
スター
3.8k
フォーク
139
PR マージ指標
30日以内にマージされた PR はありません

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

facebookincubator/MetaPython のほかの issue

facebookincubator/MetaPython の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。