Skip to content
Myr

Handle encoding of `None` when decoding unicode

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

If encoding is None, decoding will throw the following TypeError: TypeError: unicode() argument 2 must be string, not None If this is the case, attempt to run without any set encoding

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

  • other:+5 added−0 removed

1 file+5 added−0 removed

modified:requests/models.py+5 added
832 unmodified lines
833 # indicate a misspelling or similar mistake.834 #835 # So we try blindly encoding.836 content = str(self.content, errors='replace')837 except TypeError:838 # A TypeError can be raised if encoding is None839 #840 # So we try blindly encoding.841 content = str(self.content, errors='replace')842843 return content844845 @property
50 unmodified lines