Skip to content
Myr

Python 2 compatibility

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

authored by Skipper Seabold · committed by Nate Prewitt · parent af7729f · Browse files · 1 file+7 added−1 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+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:requests/utils.py+7 added-1 removed
87 unmodified lines
88 if hasattr(o, 'seek') and total_length is None:89 # StringIO has a notimplemented fileno90 # BytesIO has seek and not fileno91 total_length = o.seek(0, 2)92 # StringIO objects in py2 returns None93 if total_length is None and hasattr(o, 'tell'):94 total_length = o.tell()95 elif total_length is None:96 total_length = 09798 # seek back to current position to support partially read file-like93 o.seek(current_position)99 o.seek(current_position or 0)100101 return max(0, total_length - current_position)102103
723 unmodified lines