Message219381
Hi Stefan,
There is a comment at the top in structseq.c
/* Fields with this name have only a field index, not a field name.
They are only allowed for indices < n_visible_fields. */
char *PyStructSequence_UnnamedField = "unnamed field";
This is the definition of os.stat_result in posixmodule.c:
static PyStructSequence_Field stat_result_fields[] = {
{"st_mode", "protection bits"},
{"st_ino", "inode"},
{"st_dev", "device"},
{"st_nlink", "number of hard links"},
{"st_uid", "user ID of owner"},
{"st_gid", "group ID of owner"},
{"st_size", "total size, in bytes"},
/* The NULL is replaced with PyStructSequence_UnnamedField later. */
{NULL, "integer time of last access"},
{NULL, "integer time of last modification"},
{NULL, "integer time of last change"},
{"st_atime", "time of last access"},
{"st_mtime", "time of last modification"},
{"st_ctime", "time of last change"},
{"st_atime_ns", "time of last access in nanoseconds"},
{"st_mtime_ns", "time of last modification in nanoseconds"},
{"st_ctime_ns", "time of last change in nanoseconds"},
...
By visible i mean the values present in the repr of the object and by-extension accessible by position.
I talked about my problems with os.stat_result in points 3 and 4 of msg202333 i.e repr of os.stat_result takes the first three keys from the attribute-access only fields (the invisible part) and uses them for the last three values in the displayed structseq.
With my current patch, _fields for os.stat_result only has 7 values:
>>> x = os.stat('.')
>>> x._fields
('st_mode', 'st_ino', 'st_dev', 'st_nlink', 'st_uid', 'st_gid', 'st_size')
>>>
Is this what you expect? |
|
Date |
User |
Action |
Args |
2014-05-30 09:38:45 | sunfinite | set | recipients:
+ sunfinite, lemburg, georg.brandl, rhettinger, terry.reedy, amaury.forgeotdarc, gjb1002, belopolsky, salty-horse, vstinner, jackdied, eric.smith, giampaolo.rodola, christian.heimes, benjamin.peterson, adlaiff6, eric.araujo, Arfrever, skrah, santoso.wijaya, ethan.furman, eric.snow, abarnert |
2014-05-30 09:38:44 | sunfinite | set | messageid: <1401442724.87.0.294945433645.issue1820@psf.upfronthosting.co.za> |
2014-05-30 09:38:44 | sunfinite | link | issue1820 messages |
2014-05-30 09:38:43 | sunfinite | create | |
|