AttributeError: type object Signature has no attribute _encoding
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 408
- 平均合并
- 2 天 57 分钟
- 30 天内合并 PR
- 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()
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在安装了 Python 3.9.16、pygit2 v1.12.2 和从 PyPI 安装的 Ray 的 Docker 环境中运行所提供的复现,并比较有 Ray 和没有 Ray 时的执行情况。跟踪 Signature 何时丢失 _encoding,并确定一个针对性强的回归测试;完成的标准是复现的 Ray 用例不再引发 AttributeError。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100