libgit2 / libgit2/pygit2

AttributeError: type object Signature has no attribute _encoding

Ouverte
#1,224 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Python
Étoiles
1.7k
Forks
408
Merge moyen
2 j 57 min
PR mergées (30 j)
7

Description

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()

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par exécuter la reproduction fournie dans l’environnement Docker avec Python 3.9.16, pygit2 v1.12.2 et Ray installé depuis PyPI, en comparant l’exécution avec et sans Ray. Suivez le moment où Signature perd _encoding et identifiez un test de régression ciblé ; c’est terminé lorsque le cas Ray reproduit ne lève plus AttributeError.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
backend
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.