Document that Response.iter_lines is broken and should be avoided #6570
+8
−3
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.
The
Response.iter_lines
method is seriously broken (it inserts fake blank lines in unpredictable places.)The earliest report of this I've found is pull #2431 (January 2015).
The behavior was apparently fixed in the 3.0.0 branch, by pulls #3923 and #3984. (I think #3923 fixes the
delimiter!=None
case and #3984 fixes thedelimiter=None
case. But I haven't tested it.)The problem was raised again in issues #3980, #4121, and #5540.
Pull #4629 attempted to partially fix the issue in the master branch, and was rejected.
Personally, I am skeptical that there is any benefit in preserving this broken behavior. But folks who know better than I do have said that it needs to be maintained.
As long as this isn't fixed, people using the library should be informed that method is broken and they shouldn't use it.