On Thu, Aug 2, 2018 at 3:39 PM MRAB <pyt...@mrabarnett.plus.com> wrote:

> In the relevant code, is policy.mangle_from_ ever None?
>

That's impossible to know, since the initializer where this code originally
appears puts no constraints on the value of 'policy', it's just assumed to
have a 'mangle_from_' member...  I would be paranoid and assume, yes, it
can take on a value of None as there's nothing to indicate that it can't.

class Generator:
...
    def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, *,
                 policy=None):
...
        if mangle_from_ is None:
            mangle_from_ = True if policy is None else policy.mangle_from_
        self._fp = outfp
        self._mangle_from_ = mangle_from_
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to