Submodule.open() fails if the submodule was created from a subclass of Repository.
For example:
class CustomRepoClass(pygit2.Repository):
pass
r = CustomRepoClass("some-repo")
s = r.submodules["submodule-name"].open()
# Traceback (most recent call last):
# (...snip...)
# File "pygit2/submodules.py", line 60, in open
# return self._repo._from_c(crepo[0], True)
# File "pygit2/repository.py", line 1551, in _from_c
# super(cls, repo)._from_c(bytes(ffi.buffer(cptr)[:]), owned)
# File "pygit2/repository.py", line 1549, in _from_c
# cptr[0] = ptr
# TypeError: initializer for ctype 'struct git_repository *' must be a cdata pointer, not bytes
Submodule.open()
fails if the submodule was created from a subclass of Repository.For example:
This PR fixes this issue.