Skip to content
Myr

do not blindly catch all AttributeErrors

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

see shazow/urllib3#618

authored by Thomas Weißschuh · committed by Thomas Weißschuh · parent 8686255 · Browse files · 1 file+4 added−3 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+4 added−3 removed

  • other:+4 added−3 removed

1 file+4 added−3 removed

modified:requests/models.py+4 added-3 removed
646 unmodified lines
647648 If decode_unicode is True, content will be decoded using the best649 available encoding based on the response.650 """651652 def generate():652 try:653 # Special case for urllib3.653 # Special case for urllib3.654 if hasattr(self.raw, 'stream'):655 try:656 for chunk in self.raw.stream(chunk_size, decode_content=True):657 yield chunk658 except ProtocolError as e:
1 unmodified line
660 except DecodeError as e:661 raise ContentDecodingError(e)662 except ReadTimeoutError as e:663 raise ConnectionError(e)663 except AttributeError:664 else:665 # Standard file-like object.666 while True:667 chunk = self.raw.read(chunk_size)668 if not chunk:
174 unmodified lines