New submission from Ethan Furman:

First, the behavior for pwd.struct_passwd:
-----------------------------------------
--> pwd.getpwuid(1000)
pwd.struct_passwd(pw_name='ethan', pw_passwd='x', pw_uid=1000, pw_gid=1000, 
pw_gecos='Ethan Furman,,,', pw_dir='/home/ethan', pw_shell='/bin/bash')

--> set(pwd.getpwuid(1000))
set(['/bin/bash', 1000, 'Ethan Furman,,,', '/home/ethan', 'ethan', 'x'])

--> set([pwd.getpwuid(1000)])
set([pwd.struct_passwd(pw_name='ethan', pw_passwd='x', pw_uid=1000, 
pw_gid=1000, pw_gecos='Ethan Furman,,,', pw_dir='/home/ethan', 
pw_shell='/bin/bash')])

Now, the behavior for grp.struct_group:
--------------------------------------
--> grp.getgrgid(1000)
grp.struct_group(gr_name='ethan', gr_passwd='x', gr_gid=1000, gr_mem=[])

--> set(grp.getgrgid(1000))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'

--> set([grp.getgrgid(1000)])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'


At the very least the error message is wrong (it's not a list), and at the most 
grp.struct_group should be hashable  -- i.e. we should be able to have a set of 
groups.

----------
messages: 227811
nosy: ethan.furman
priority: normal
severity: normal
status: open
title: grp.struct_group is not hashable
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22513>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to