[issue32033] The pwd module implementation incorrectly sets some attributes to None
Serhiy Storchaka
report at bugs.python.org
Wed Nov 15 12:41:29 EST 2017
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
I disagree. This is an old API, a thin wrapper around standard POSIX API, and returning an empty string instead of None will make impossible to distinguish NULL from "".
It is easy to convert None in an empty string in Python: `value or ''`.
I would change the test to
if field is not None:
self.assertIsInstance(field, str)
or
self.assertIsInstance(field, (str, type(None)))
(I prefer the former variant).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32033>
_______________________________________
More information about the Python-bugs-list
mailing list