GeezerVison is showing github.com — objects: decode a byte mode before reading its digits by SashaMIT · Pull Request #2261 · gitpython-developers/GitPython
Conversation
SashaMIT
commented
Oct 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
mode_str_to_int(b"100644") returned 1830740 (0o6767524). A byte is an int, so the digit 4 was read as 52. mode_str_to_int("100644") was already 0o100644. A byte string is decoded before the digits are read. b"120000" is 0o120000. 644 is still 0o644.
Test plan
-
pytest -o addopts= test/test_util.py::test_mode_str_to_int_accepts_bytes (passed; on tip the byte mode was 1830740)
Drafted with Grok 4.7. The code has not yet been reviewed by a human.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
mode_str_to_int(b"100644") returned 1830740. A byte is an int, so the
digit 4 was read as 52. A text mode was already 0o100644.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟢 Approval recommended
The focused fix correctly handles byte modes and includes adequate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes byte-based Git mode parsing by decoding bytes before converting octal digits.
Changes:
- Decode byte modes as ASCII.
- Add regression coverage for string and byte modes.
| File |
Description |
git/objects/util.py |
Corrects byte mode conversion. |
test/test_util.py |
Adds regression tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
SashaMIT reacted with heart emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.