bpo-42461: show f_fsid when pring os.statvfs object

Since python 3.7, f_fsid was added to os.statvfs, but it didn't show
up when print the object. So add one more field to output.
This commit is contained in:
haoyixing 2020-11-25 18:08:52 +08:00
parent 8d17d2bd0a
commit 19f186a6eb
2 changed files with 4 additions and 4 deletions

View File

@ -607,14 +607,14 @@ class StatAttributeTests(unittest.TestCase):
# Make sure all the attributes are there.
members = ('bsize', 'frsize', 'blocks', 'bfree', 'bavail', 'files',
'ffree', 'favail', 'flag', 'namemax')
'ffree', 'favail', 'flag', 'namemax', 'fsid')
for value, member in enumerate(members):
self.assertEqual(getattr(result, 'f_' + member), result[value])
self.assertTrue(isinstance(result.f_fsid, int))
# Test that the size of the tuple doesn't change
self.assertEqual(len(result), 10)
self.assertEqual(len(result), 11)
# Make sure that assignment really fails
try:

View File

@ -2188,7 +2188,7 @@ static PyStructSequence_Desc stat_result_desc = {
PyDoc_STRVAR(statvfs_result__doc__,
"statvfs_result: Result from statvfs or fstatvfs.\n\n\
This object may be accessed either as a tuple of\n\
(bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax),\n\
(bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax, fsid),\n\
or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.\n\
\n\
See os.statvfs for more information.");
@ -2212,7 +2212,7 @@ static PyStructSequence_Desc statvfs_result_desc = {
"statvfs_result", /* name */
statvfs_result__doc__, /* doc */
statvfs_result_fields,
10
11
};
#if defined(HAVE_WAITID) && !defined(__APPLE__)