In Python 2 a subclass of UserString would return an instance of that subclass from encode(). This is invalid in Python 3, where the result of encode() should always be `bytes`. Also: * Collapse the 3 code paths in UserString.encode() into a single path by lifting the underlying str.encode() defaults into the method signature
NB: Minor backward compatibility break for any existing code that
specifies encoding='' (or any other 'Falsy' value)
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
…pythonGH-13138) (cherry picked from commit 2a16eea) Co-authored-by: Daniel Fortunov <asqui@users.noreply.github.com>
rhettinger pushed a commit that referenced this pull request
asqui deleted the UserString-encode-fix-bpo-36582 branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters