You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Return type mismatch in repo.submodule_update() #2077
Hello everyone! repo.submodule_update is annotated to return an Iterator[Submodule] (and I hoped it might return an iterator of modified modules or something similar).
Unfortunately the implementation uses a strange and unnecessary OOM abstraction which makes everything harder to understand. This is probably also the reason the type is off here.
The best fix would certainly be if there was no RootSubmodule at all. But maybe there is also a simple type-based fix that already helps.
Activity
Byron commentedon Oct 21, 2025
Thanks for reporting.
Unfortunately the implementation uses a strange and unnecessary OOM abstraction which makes everything harder to understand. This is probably also the reason the type is off here.
The best fix would certainly be if there was no
RootSubmoduleat all. But maybe there is also a simple type-based fix that already helps.extrwi commentedon Oct 21, 2025
To me it looks like the return type might have been introduced as a copy and paste bug from the method right above it:
GitPython/git/repo/base.py
Line 512 in ba5c10d
The most important problem with the type mismatch is that the value returned by
updateis not iterable at all. :-)Use actual return type in annotation for method submodule_update
extrwi commentedon Oct 21, 2025
Please merge my PR if you agree or just close it otherwise. ;-)