Issue 12412: non defined representation for pwd.struct_passwd (original) (raw)
Created on 2011-06-25 15:54 by fgarciar, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (6)
Author: Francisco Garcia (fgarciar)
Date: 2011-06-25 15:54
pwd.struct_passwd has different representations in cpython 2.7.2 and pypy 1.5
A unit test from cpython might enforce the same representation across interpreters:
print pwd.getpwuid(os.getuid())
Current cpython output:
pwd.struct_passwd(pw_name='demo_user', pw_passwd='********', pw_uid=1001, pw_gid=100, pw_gecos='demo_user', pw_dir='/Users/demo_user', pw_shell='/bin/bash')
Current pypy output ('demo_user', '********', 1001, 100, 'demo_user', '/Users/demo_user', '/bin/bash')
Author: R. David Murray (r.david.murray) *
Date: 2011-06-25 16:15
Looks like the difference between a regular tuple and a named tuple. The correct test is to access the members using the names, and the test suite currently does this. The repr shouldn't, I think, be required to be identical.
On the other hand, if pypy is implementing named tuples and the repr doesn't include the names, perhaps there is a missing test in the tests of named tuples.
Author: Éric Araujo (eric.araujo) *
Date: 2011-07-02 13:56
The docs indeed don’t say more that “Password database entries are reported as a tuple-like object, whose attributes correspond to the members of the passwd structure”; no mention is made of named tuple or struct sequence.
I think there is no bug for CPython; you may want to suggest friendlier reprs for structseqs to PyPy.
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *
Date: 2011-07-03 17:18
pypy did not use a structseq in this case. Fixed in (pypy's repo) dded6e510044
Author: R. David Murray (r.david.murray) *
Date: 2011-07-03 17:47
But pypy passed the attribute access tests in the test suite?
Author: Éric Araujo (eric.araujo) *
Date: 2011-07-13 15:34
Actually, I’ve found that there are some structseq’s repr that get tested in the CPython test suite.
History
Date
User
Action
Args
2022-04-11 14:57:19
admin
set
github: 56621
2011-07-13 15:34:39
eric.araujo
set
messages: +
2011-07-03 17:47:41
r.david.murray
set
messages: +
2011-07-03 17🔞06
amaury.forgeotdarc
set
nosy: + amaury.forgeotdarc
messages: +
2011-07-02 13:56:24
eric.araujo
set
status: open -> closed
nosy: + eric.araujo, benjamin.peterson
messages: +
resolution: works for me
stage: resolved
2011-06-25 16:15:57
r.david.murray
set
nosy: + r.david.murray
messages: +
2011-06-25 15:54:49
fgarciar
create