This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sunfinite
Recipients Arfrever, abarnert, adlaiff6, amaury.forgeotdarc, belopolsky, benjamin.peterson, christian.heimes, eric.araujo, eric.smith, eric.snow, ethan.furman, georg.brandl, giampaolo.rodola, gjb1002, jackdied, lemburg, rhettinger, salty-horse, santoso.wijaya, skrah, sunfinite, terry.reedy, vstinner
Date 2014-05-30.09:38:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:45sunfinitesetrecipients: + 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:44sunfinitesetmessageid: <>
2014-05-30 09:38:44sunfinitelinkissue1820 messages
2014-05-30 09:38:43sunfinitecreate