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
dcfdae7d
Commit
dcfdae7d
authored
Apr 01, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1460564: document that socket.fromfd() duplicates the given
file descriptor.
parent
e071b001
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Doc/lib/libsocket.tex
Doc/lib/libsocket.tex
+5
-4
Modules/socketmodule.c
Modules/socketmodule.c
+3
-2
No files found.
Doc/lib/libsocket.tex
View file @
dcfdae7d
...
...
@@ -317,10 +317,11 @@ Availability: \UNIX. \versionadded{2.4}
\end{funcdesc}
\begin{funcdesc}
{
fromfd
}{
fd, family, type
\optional
{
, proto
}}
Build a socket object from an existing file descriptor (an integer as
returned by a file object's
\method
{
fileno()
}
method). Address family,
socket type and protocol number are as for the
\function
{
socket()
}
function
above. The file descriptor should refer to a socket, but this is not
Duplicate the file descriptor
\var
{
fd
}
(an integer as returned by a file
object's
\method
{
fileno()
}
method) and build a socket object from the
result. Address family, socket type and protocol number are as for the
\function
{
socket()
}
function above.
The file descriptor should refer to a socket, but this is not
checked --- subsequent operations on the object may fail if the file
descriptor is invalid. This function is rarely needed, but can be
used to get or set socket options on a socket passed to a program as
...
...
Modules/socketmodule.c
View file @
dcfdae7d
...
...
@@ -3168,7 +3168,8 @@ socket_fromfd(PyObject *self, PyObject *args)
PyDoc_STRVAR
(
fromfd_doc
,
"fromfd(fd, family, type[, proto]) -> socket object
\n
\
\n
\
Create a socket object from the given file descriptor.
\n
\
Create a socket object from a duplicate of the given
\n
\
file descriptor.
\n
\
The remaining arguments are the same as for socket()."
);
#endif
/* NO_DUP */
...
...
@@ -4052,7 +4053,7 @@ init_socket(void)
PyModule_AddIntConstant
(
m
,
"NETLINK_IP6_FW"
,
NETLINK_IP6_FW
);
PyModule_AddIntConstant
(
m
,
"NETLINK_DNRTMSG"
,
NETLINK_DNRTMSG
);
PyModule_AddIntConstant
(
m
,
"NETLINK_TAPBASE"
,
NETLINK_TAPBASE
);
#endif
#endif
/* AF_NETLINK */
#ifdef AF_ROUTE
/* Alias to emulate 4.4BSD */
PyModule_AddIntConstant
(
m
,
"AF_ROUTE"
,
AF_ROUTE
);
...
...
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