[issue10392] GZipFile crash when fileobj.mode is None

R. David Murray report at bugs.python.org
Sat Nov 13 09:45:01 CET 2010


R. David Murray <rdmurray at bitdance.com> added the comment:

Yes.  However, if None were a valid value for mode, then the would would instead do something like:

SENTINEL = object()

class GZipFile...

    def __init__(self, filename=None, mode=SENTINEL, ...

and then where None currently appears in the logic of the method, mode would be checked against SENTINEL to see if no value had been passed to the mode argument.

Thus the presence of None in the __init__ signature actually indicates that None is explicitly *not* a valid value for mode (and thus can safely be used as a sentinel value).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10392>
_______________________________________


More information about the Python-bugs-list mailing list