python / python/mypy

Mypyc produces module that crashes (segmentation fault) when executed

オープン
#18,992 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

crash topic-mypyc
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

compiled.py:

from typing import Generic, TypeVar

_T = TypeVar("_T")

class Bar(Generic[_T]):
    def __init__(self) -> None:
        self.value: str = 'start'
    def __get__(self, instance: _T, owner: type[_T] | None = None) -> str:
        return self.value
    def __set__(self, instance: _T, value: str) -> None:
        self.value = value

class Foo(object):
    bar: Bar = Bar()

Compiled with python3 -m mypyc compiled.py.

test.py:

import compiled

print("hello")

f = compiled.Foo()
print(f.bar)

f.bar = 'test'
print(f.bar)

And running with:

$ python3 test.py
hello
<compiled.Bar object at 0x7464e7774310>
Segmentation fault

Using current master of mypyc:

$ python3 -m mypyc --version
mypy 1.16.0+dev.7b4f6311e29452cc8d4ddb78331d0047c8b17e93.dirty (compiled: no)

Using Python 3.13.1

If running with python3 directly:

$ python3 test.py
hello
start
test

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

compiled.py を python3 -m mypyc でコンパイルし、Python 3.13.1 で test.py を実行してクラッシュを再現します。コンパイル後の動作と Python の直接実行を比較し、ジェネリックディスクリプタと Foo.bar へのアクセスに焦点を当てます。コンパイルされたモジュールが segmentation fault を起こさずに hello、start、test を出力すれば完了です。

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

評価

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

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

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