[docs] [issue18600] email.policy doc example passes 'policy' to as_string, but that doesn't work

R. David Murray report at bugs.python.org
Fri Aug 9 21:52:21 CEST 2013

R. David Murray added the comment:

Turns out even with as_string accepting a policy keyword, the example still failed.  It needs to be generating a bytes object, not a string.  Before I even realized that, though, I decided I wanted to add as_bytes (and __bytes__).  So the attached patch does that: adds policy to as_string, and adds new methods as_bytes and __bytes__ to Message.

This patch is only for 3.4.  The 3.3 patch will just delete that part of the policy example, so I'm not going to bother to upload it.

keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file31209/as_string_policy.patch

Python tracker <report at bugs.python.org>

More information about the docs mailing list