我正在努力将一些python2代码移植到python3 --单一代码库。我在cpython2.7上使用pygit2 0.28.2,在cpython3.10上使用pygit2 1.9.2,至少目前是这样。
我得到一个错误(-3)从:
err = C.git_remote_push(self._remote, refspecs, opts)...and payload.check_error(err)将其映射为:
KeyError: 'the requested type does not match the type in the ODB'该错误仅出现在cpython2.7 3.10上,而不是cpython2.7 2.7上。
恐怕我不知道该如何处理这个错误。我在谷歌上搜索了大约90分钟,但没找到多少。
以下是完整的回溯:
Traceback (most recent call last):
File "/app/shared/common/git/handlers.py", line 488, in Push
remote.push(temp3, callbacks=self.callbacks)
File "/usr/local/lib/python3.10/site-packages/pygit2/remote.py", line 257, in push
payload.check_error(err)
File "/usr/local/lib/python3.10/site-packages/pygit2/callbacks.py", line 93, in check_error
check_error(error_code)
File "/usr/local/lib/python3.10/site-packages/pygit2/errors.py", line 56, in check_error
raise KeyError(message)'
KeyError: 'the requested type does not match the type in the ODB'有人能给我一个正确的方向吗?这是什么类型的抱怨?对pygit2来说,传递的数据似乎是相当不透明的。
是否有可能pygit2 0.28.2总是“强制”,而pygit2 1.9.2只会按请求强制?我们在Python 3中关闭了libgit2 2的“严格模式”。
谢谢!
发布于 2022-10-05 20:11:33
结果表明,如果我们从0.28.2开始,pygit2 0.28.2就能工作。如果我们稍后进行一些操作,比如1.5.0并手动切换到0.28.2,那么git回购已经造成了损害,导致了0.28.2的错误。
很可能(有些)后来的版本也很高兴,但这是另一个故事。
https://stackoverflow.com/questions/73888734
复制相似问题