已合并
Fix Ggit override for pygobject 3.42+ compatibility #16
Funda Wang创建于 8月20日
Fix Ggit override for pygobject 3.42+ compatibility #16
已合并
Funda Wang创建于 8月20日
从已删除 :fix-ggit-override-module合入到src-openeuler/libgit2-glibmaster
Funda Wang
Funda Wang
8月20日

当前PR是否有AI参与:

[ ] 否

[x] Yes
__1. AI Agent 平台: AtomCode
__2. AI 模型 : deepseek-v4-flash
__3. Prompt 上下文 : 修复 lorax-composer 崩溃:pygobject >= 3.42 下 Ggit override 动态类 module 落在 gi.types 触发 KeyError("You have tried override outside of the overrides module"),在 Ggit.py 的 _override_dyn 中显式设置 module 为 gi.overrides.Ggit,并新增 %check import 检查及 python3-gobject/-base BuildRequires

参考:openEuler社区《生成式AI工具使用与开源贡献政策》

PR功能描述 / 为什么需要这个合入**:

修复 python3-gobject >= 3.42 下加载 Ggit override 时的 KeyError:
You have tried override outside of the overrides module. This is not allowed (<class 'gi.types.Branch'>, gi.types)

根因:Ggit.py 的 _override_dyn 动态创建 override 类时未设置 __module__,pygobject 的 gi.overrides.override() 检查 type_.__module__.startswith("gi.overrides") 失败。动态类经 metaclass(GObjectMeta)创建后 __module__ 落到 gi.types,触发 KeyError,导致 lorax-composer 等使用 Ggit 的程序在运行时崩溃。

修复:在 type() 创建动态类时显式设置 __module__ = 'gi.overrides.Ggit',通过 pygobject 的模块检查。同时在 spec 中新增 %check 阶段的 Ggit import 检查,构建时即可拦截此类回归,并补充 python3-gobject/python3-gobject-base 的 BuildRequires。

该补丁兼容新旧版 pygobject:旧版无此检查时 __module__ 是无害属性,新版(>= 3.42)恰好通过检查。

该PR关联的issue

https://atomgit.com/src-openeuler/lorax/issues/37

希望检视人员了解:

  • 补丁只改 Ggit.py 的 _override_dyn 一行,设置动态类的 __module__
  • %check 依赖 python3-gobject-base(gi 模块所在包),已显式声明 BuildRequires
  • 建议在含 python3-gobject >= 3.42 的环境中构建验证
likedislike
Pull Request已成功合入, 合并人@openeuler-ci-bot
(感谢 Funda Wang 的贡献)
Funda WangFunda Wang
8月20日 创建了 pull request,commit c415e019
openeuler-ci-botopeneuler-ci-bot成员
8月20日 添加了label:ai-co-authored
openeuler-ci-bot
openeuler-ci-bot成员
8月20日 评论:

当前仓库存在以下 保护分支 :

Protected Branch Version Release
master 1.2.1 2
openEuler-26.09-DevStation 1.2.1 2
openEuler-26.09 1.2.1 2
openEuler-24.03-LTS-SP4 1.2.0 1
openEuler-24.03-LTS-SP3 1.2.0 1
openEuler-24.03-LTS-SP1 1.2.0 1
openEuler-24.03-LTS-Next 1.2.0 1
openEuler-22.03-LTS-SP4 0.99.0.1 1
openEuler-20.03-LTS-SP4 0.27.8 2
openEuler1.0-base 0.27.8 2
openEuler1.0 0.27.8 2

评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作

注意:

  1. /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
  2. 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭
likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月20日 将licihua,dillon_chen,overweight,zhujianwei001,xujing99,shenyangyang设为审查人
openeuler-ci-botopeneuler-ci-bot成员
8月20日 添加了label:ai-includes-code
此处折叠了76条消息 查看更多
陈棋德
陈棋德成员
8月20日 评论:

/lgtm
/approve

likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月20日 添加了label:approvedlgtm
openeuler-ci-bot
openeuler-ci-bot成员
8月20日 评论:

Review Code Feedback

  • The label lgtm, approved was added to this pull request. It means that dillon_chen reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄
likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月20日 合入了pull request,合并节点 SHA:4996709b18d4523b2f6fcfaeacef684d4f27f847
openeuler-ci-bot
openeuler-ci-bot成员
8月20日 评论:

In response to this:

/sync openEuler-26.09-DevStation

@fundawang

同步操作执行结果:

Branch Status Pull Request
openEuler-26.09-DevStation 创建同步 PR https://gitcode.com/src-openeuler/libgit2-glib/merge_requests/17
likedislike