(original) (raw)

changeset: 103387:ddb1cf7b7eb1 parent: 103385:30f20247bd14 parent: 103386:468961cea562 user: R David Murray rdmurray@bitdance.com date: Thu Sep 08 22:27:39 2016 -0400 files: Lib/email/generator.py description: Merge: #27630: Be consistent in how _XXX/_encoded_XXX vars are initialized. diff -r 30f20247bd14 -r ddb1cf7b7eb1 Lib/email/generator.py --- a/Lib/email/generator.py Fri Sep 09 03:57:23 2016 +0300 +++ b/Lib/email/generator.py Thu Sep 08 22:27:39 2016 -0400 @@ -97,7 +97,7 @@ self._NL = policy.linesep self._encoded_NL = self._encode(self._NL) self._EMPTY = '' - self._encoded_EMPTY = self._encode('') + self._encoded_EMPTY = self._encode(self._EMPTY) # Because we use clone (below) when we recursively process message # subparts, and because clone uses the computed policy (not None), # submessages will automatically get set to the computed policy when @@ -137,10 +137,6 @@ # it has already transformed the input; but, since this whole thing is a # hack anyway this seems good enough. - # Similarly, we have _XXX and _encoded_XXX attributes that are used on - # source and buffer data, respectively. - _encoded_EMPTY = '' - def _new_buffer(self): # BytesGenerator overrides this to return BytesIO. return StringIO() @@ -402,10 +398,6 @@ The outfp object must accept bytes in its write method. """ - # Bytes versions of this constant for use in manipulating data from - # the BytesIO buffer. - _encoded_EMPTY = b'' - def write(self, s): self._fp.write(s.encode('ascii', 'surrogateescape')) /rdmurray@bitdance.com