Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
96a5e50a
Commit
96a5e50a
authored
Dec 14, 2017
by
Giuseppe Scrivano
Committed by
Fred Drake
Dec 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-32143: add f_fsid to os.statvfs() (#4571)
Signed-off-by:
Giuseppe Scrivano
<
gscrivan@redhat.com
>
parent
2b5fd1e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
1 deletion
+12
-1
Doc/library/os.rst
Doc/library/os.rst
+4
-1
Lib/test/test_os.py
Lib/test/test_os.py
+5
-0
Misc/NEWS.d/next/Library/2017-11-26-17-28-26.bpo-32143.o7YdXL.rst
...S.d/next/Library/2017-11-26-17-28-26.bpo-32143.o7YdXL.rst
+1
-0
Modules/posixmodule.c
Modules/posixmodule.c
+2
-0
No files found.
Doc/library/os.rst
View file @
96a5e50a
...
...
@@ -2436,7 +2436,7 @@ features:
correspond to the members of the :c:type:`statvfs` structure, namely:
:attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`,
:attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`,
:attr:`f_flag`, :attr:`f_namemax`.
:attr:`f_flag`, :attr:`f_namemax`
, :attr:`f_fsid`
.
Two module-level constants are defined for the :attr:`f_flag` attribute's
bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted
...
...
@@ -2471,6 +2471,9 @@ features:
.. versionchanged:: 3.6
Accepts a :term:`path-like object`.
.. versionadded:: 3.7
Added :attr:`f_fsid`.
.. data:: supports_dir_fd
...
...
Lib/test/test_os.py
View file @
96a5e50a
...
...
@@ -352,6 +352,11 @@ class StatAttributeTests(unittest.TestCase):
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
)
# Make sure that assignment really fails
try
:
result
.
f_bfree
=
1
...
...
Misc/NEWS.d/next/Library/2017-11-26-17-28-26.bpo-32143.o7YdXL.rst
0 → 100644
View file @
96a5e50a
os.statvfs() includes the f_fsid field from statvfs(2)
Modules/posixmodule.c
View file @
96a5e50a
...
...
@@ -1860,6 +1860,7 @@ static PyStructSequence_Field statvfs_result_fields[] = {
{
"f_favail"
,
},
{
"f_flag"
,
},
{
"f_namemax"
,},
{
"f_fsid"
,
},
{
0
}
};
...
...
@@ -9324,6 +9325,7 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) {
PyStructSequence_SET_ITEM
(
v
,
8
,
PyLong_FromLong
((
long
)
st
.
f_flag
));
PyStructSequence_SET_ITEM
(
v
,
9
,
PyLong_FromLong
((
long
)
st
.
f_namemax
));
#endif
PyStructSequence_SET_ITEM
(
v
,
10
,
PyLong_FromUnsignedLong
(
st
.
f_fsid
));
if
(
PyErr_Occurred
())
{
Py_DECREF
(
v
);
return
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment