libgit2 / libgit2/pygit2

AttributeError: type object Signature has no attribute _encoding

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

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

主要言語
Python
スター
1.7k
フォーク
408
平均マージ
2日 57分
マージ済み PR(30日)
7

説明

Hi folks!

I'm running into this weird error when running my python code with ray.
Basically I get AttributeError: type object 'Signature' has no attribute '_encoding'.
But it works fine when I run my script without ray...

pygit2 version: v1.12.2
environment: python:3.9.16 docker container.

The error can be reproduced with the code below.
Ray can be installed from PyPi: pip install ray

import pygit2
import ray
from pygit2 import Signature


def function_without_ray():
    org_name = "libgit2"
    repo_name = "pygit2"
    repo = pygit2.clone_repository(
        f"https://github.com/{org_name}/{repo_name}",
        f"/tmp/{repo_name}.git",
    )
    new_branch = repo.branches.create(
        "dummy-branch", repo.revparse_single("HEAD")
    )
    repo.checkout(new_branch)

    index = repo.index
    index.add_all()
    index.write()

    author = Signature("John Doe", "john@doe.com")

    ref = repo.head.name
    tree = index.write_tree()
    parents = [repo.head.target]

    repo.create_commit(
        ref,
        author,
        author,
        "Just a dummy commit",
        tree,
        parents,
    )


@ray.remote
def function_with_ray():
    function_without_ray()

# Comment out one of these function calls to check if it works:
ray.get(function_with_ray.remote())

function_without_ray()

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

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

はじめの一歩

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

調査の方向性

まず、Python 3.9.16、pygit2 v1.12.2、PyPI からインストールした Ray を使用する Docker 環境で、提供された再現手順を実行し、Ray ありの場合となしの場合の実行を比較します。Signature が _encoding を失うタイミングを追跡し、焦点を絞った回帰テストを特定します。完了の条件は、再現された Ray のケースで AttributeError が発生しなくなることです。

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

評価

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

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

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