Skip to content
Myr

removing use of seek to set total_length

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nate Prewitt · committed by Nate Prewitt · parent 8873a09 · Browse files · 1 file+8 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−10 removed

  • other:+8 added−10 removed

1 file+8 added−10 removed

modified:requests/utils.py+8 added-10 removed
84 unmodified lines
85 # let requests chunk it instead.86 if total_length is not None:87 current_position = total_length8889 if hasattr(o, 'seek') and total_length is None:90 # StringIO has a notimplemented fileno91 # BytesIO has seek and not fileno92 total_length = o.seek(0, 2)93 # StringIO objects in py2 returns None94 if total_length is None and hasattr(o, 'tell'):89 if hasattr(o, 'seek') and total_length is None:90 # StringIO and BytesIO have seek but no useable fileno9192 # seek to end of file93 o.seek(0, 2)94 total_length = o.tell()96 elif total_length is None:97 total_length = 09599 # seek back to current position to support partially read file-like100 o.seek(current_position or 0)96 # seek back to current position to support97 # partially read file-like objects98 o.seek(current_position or 0)99100 if total_length is None:101 total_length = 0102
726 unmodified lines