]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-122989: Replace duplicate “self.policy.linesep” with “linesep” (#123002)
authorDamien <81557462+Damien-Chen@users.noreply.github.com>
Wed, 4 Sep 2024 06:30:25 +0000 (14:30 +0800)
committerGitHub <noreply@github.com>
Wed, 4 Sep 2024 06:30:25 +0000 (02:30 -0400)
`linesep` is already defined as `self.policy.linesep`.  It appears that previous refactor was not completed.

Lib/email/generator.py

index 42c84aa4da10444ae1b66c70ece61db6adbcf923..205caf0fe9e81dbdbc96ab873650881734fbfc2c 100644 (file)
@@ -227,7 +227,7 @@ class Generator:
             folded = self.policy.fold(h, v)
             if self.policy.verify_generated_headers:
                 linesep = self.policy.linesep
-                if not folded.endswith(self.policy.linesep):
+                if not folded.endswith(linesep):
                     raise HeaderWriteError(
                         f'folded header does not end with {linesep!r}: {folded!r}')
                 if NEWLINE_WITHOUT_FWSP.search(folded.removesuffix(linesep)):