-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(bindings/python): Make sure read until EOF #4995
Conversation
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.
Thank you for your effort. However, I believe this fix is incorrect.
The root cause lies in:
read_content = reader.read(size + 1)
where the length of read_content
does not equal size + 1
.
Therefore, we should not directly compare read_content
with content
. Instead, we need to gather all read_content
and then perform the assertion.
This commit addresses the issue raised in the pull request apache#4989, where the `read()` operation did not always return the expected content length. Changes include: - Implementing a loop to gather all content chunks until EOF. - Performing the assertion after the entire content has been read. This ensures that the test passes stably by correctly handling cases where `read()` may not return the full content in one go.
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.
deleted the code requested in pr code review
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.
Thank you for your contribution first.
However, I'm not happy working on this PR with you. I feel like you haven't put in as much effort as I have. Sometimes, your changes make me feel like you're committing them without much thought.
Apologies in advance if I have made any wrong assumptions. Please let me know if there are areas where we can improve.
Which issue does this PR close?
Closes #4990
Rationale for this change
There wasn't any warantee that the entire file would fit inside the size variable therfore read in chunks until EOF in the case that the file size is large