Skip to content
Myr

Simplify error handling when decoding unicode

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

authored by Matt Sweeney · committed by Radu Voicilas · parent 2bb49ff · Browse files · 1 file+1 added−4 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+1 added−4 removed

  • other:+1 added−4 removed

1 file+1 added−4 removed

modified:requests/models.py+1 added-4 removed
826 unmodified lines
827828 # Decode unicode from given encoding.829 try:830 content = str(self.content, encoding, errors='replace')831 except LookupError:831 except (LookupError, TypeError):832 # A LookupError is raised if the encoding was not found which could833 # indicate a misspelling or similar mistake.834 #835 # So we try blindly encoding.836 content = str(self.content, errors='replace')837 except TypeError:835 # A TypeError can be raised if encoding is None836 #837 # So we try blindly encoding.838 content = str(self.content, errors='replace')
54 unmodified lines