diff --git a/Lib/email/generator.py b/Lib/email/generator.py index 42c84aa4da10444..205caf0fe9e81db 100644 --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -227,7 +227,7 @@ def _write_headers(self, msg): 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)):