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
b92c526e
Commit
b92c526e
authored
Aug 10, 2018
by
GPery
Committed by
Benjamin Peterson
Aug 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
closes bpo-34353: Add sockets to stat.filemode fallback python implementation. (GH-8703)
parent
a7548230
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
Lib/stat.py
Lib/stat.py
+1
-0
Lib/test/test_stat.py
Lib/test/test_stat.py
+9
-0
Misc/NEWS.d/next/Core and Builtins/2018-08-09-18-42-49.bpo-34353.GIOm_8.rst
...ore and Builtins/2018-08-09-18-42-49.bpo-34353.GIOm_8.rst
+2
-0
No files found.
Lib/stat.py
View file @
b92c526e
...
...
@@ -111,6 +111,7 @@ SF_SNAPSHOT = 0x00200000 # file is a snapshot file
_filemode_table
=
(
((
S_IFLNK
,
"l"
),
(
S_IFSOCK
,
"s"
),
# Must appear before IFREG and IFDIR as IFSOCK == IFREG | IFDIR
(
S_IFREG
,
"-"
),
(
S_IFBLK
,
"b"
),
(
S_IFDIR
,
"d"
),
...
...
Lib/test/test_stat.py
View file @
b92c526e
import
unittest
import
os
import
socket
import
sys
from
test.support
import
TESTFN
,
import_fresh_module
...
...
@@ -191,6 +192,14 @@ class TestFilemode:
self
.
assertS_IS
(
"BLK"
,
st_mode
)
break
@
unittest
.
skipUnless
(
hasattr
(
socket
,
'AF_UNIX'
),
'requires unix socket'
)
def
test_socket
(
self
):
with
socket
.
socket
(
socket
.
AF_UNIX
)
as
s
:
s
.
bind
(
TESTFN
)
st_mode
,
modestr
=
self
.
get_mode
()
self
.
assertEqual
(
modestr
[
0
],
's'
)
self
.
assertS_IS
(
"SOCK"
,
st_mode
)
def
test_module_attributes
(
self
):
for
key
,
value
in
self
.
stat_struct
.
items
():
modvalue
=
getattr
(
self
.
statmod
,
key
)
...
...
Misc/NEWS.d/next/Core and Builtins/2018-08-09-18-42-49.bpo-34353.GIOm_8.rst
0 → 100644
View file @
b92c526e
Added the "socket" option in the `stat.filemode()` Python implementation to
match the C implementation.
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