mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-32659: Solaris "stat" should support "st_fstype" (#5307)
* bpo-32659: Solaris "stat" should support "st_fstype" * Add 'versionadded'
This commit is contained in:
parent
43c0f1ac5e
commit
6c51d51880
3 changed files with 28 additions and 0 deletions
|
@ -394,6 +394,10 @@ static int win32_can_symlink = 0;
|
|||
#define MODNAME "posix"
|
||||
#endif
|
||||
|
||||
#if defined(__sun)
|
||||
/* Something to implement in autoconf, not present in autoconf 2.69 */
|
||||
#define HAVE_STRUCT_STAT_ST_FSTYPE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FORK
|
||||
static void
|
||||
|
@ -1788,6 +1792,9 @@ static PyStructSequence_Field stat_result_fields[] = {
|
|||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_FILE_ATTRIBUTES
|
||||
{"st_file_attributes", "Windows file attribute bits"},
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_FSTYPE
|
||||
{"st_fstype", "Type of filesystem"},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
|
@ -1834,6 +1841,12 @@ static PyStructSequence_Field stat_result_fields[] = {
|
|||
#define ST_FILE_ATTRIBUTES_IDX ST_BIRTHTIME_IDX
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRUCT_STAT_ST_FSTYPE
|
||||
#define ST_FSTYPE_IDX (ST_FILE_ATTRIBUTES_IDX+1)
|
||||
#else
|
||||
#define ST_FSTYPE_IDX ST_FILE_ATTRIBUTES_IDX
|
||||
#endif
|
||||
|
||||
static PyStructSequence_Desc stat_result_desc = {
|
||||
"stat_result", /* name */
|
||||
stat_result__doc__, /* doc */
|
||||
|
@ -2057,6 +2070,10 @@ _pystat_fromstructstat(STRUCT_STAT *st)
|
|||
PyStructSequence_SET_ITEM(v, ST_FILE_ATTRIBUTES_IDX,
|
||||
PyLong_FromUnsignedLong(st->st_file_attributes));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_FSTYPE
|
||||
PyStructSequence_SET_ITEM(v, ST_FSTYPE_IDX,
|
||||
PyUnicode_FromString(st->st_fstype));
|
||||
#endif
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
Py_DECREF(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue