[issue26129] Difference in behaviour with grp.getgrgid and pwd.getpwuid

Serhiy Storchaka report at bugs.python.org
Sun Jan 17 10:00:26 EST 2016


Serhiy Storchaka added the comment:

This looks as unintentional consequences of ab0221811771.

I think the current behavior of grp.getgrgid() is not correct, because it accepts str, float and other types. Python is strong-typed language and shouldn't make unwanted implicit type conversions. I guess the purpose was to support long arguments in Python 2.

There is similar problem with grp.getgrnam() in 2.7. It accepts arguments of any types and convert them to str by calling str(). I guess the purpose was to support unicode arguments. In 3.x only str is accepted.

Proposed patch deprecates accepting non-integer arguments in grp.getgrgid(). May be we can just remove this without starting deprecating process. I don't know.

----------
keywords: +patch
nosy: +brett.cannon, serhiy.storchaka
resolution: wont fix -> 
stage: resolved -> patch review
status: closed -> open
Added file: http://bugs.python.org/file41640/grp_getgrgid_non_integer_gid.patch

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


More information about the Python-bugs-list mailing list