]> granicus.if.org Git - python/commitdiff
#27630: Be consistent in how _XXX/_encoded_XXX vars are initialized.
authorR David Murray <rdmurray@bitdance.com>
Fri, 9 Sep 2016 02:21:27 +0000 (22:21 -0400)
committerR David Murray <rdmurray@bitdance.com>
Fri, 9 Sep 2016 02:21:27 +0000 (22:21 -0400)
Lib/email/generator.py

index 11ff16df9a16bc2fa8959ac452eebe310fd7af91..6d283e9add3a3559c3439a1906df7cb4bc441186 100644 (file)
@@ -97,7 +97,7 @@ class Generator:
         self._NL = policy.linesep
         self._encoded_NL = self._encode(self._NL)
         self._EMPTY = ''
-        self._encoded_EMTPY = 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 @@ class Generator:
     # 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 @@ class BytesGenerator(Generator):
     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'))