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
94681fc4
Commit
94681fc4
authored
Nov 27, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #849595: Add socket.shutdown() constants.
parent
04bf7241
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
4 deletions
+29
-4
Doc/lib/libsocket.tex
Doc/lib/libsocket.tex
+2
-2
Misc/NEWS
Misc/NEWS
+2
-0
Modules/socketmodule.c
Modules/socketmodule.c
+25
-2
No files found.
Doc/lib/libsocket.tex
View file @
94681fc4
...
...
@@ -638,8 +638,8 @@ structures as strings).
\begin{methoddesc}
[socket]
{
shutdown
}{
how
}
Shut down one or both halves of the connection. If
\var
{
how
}
is
\co
de
{
0
}
, further receives are disallowed. If
\var
{
how
}
is
\code
{
1
}
,
further sends are disallowed. If
\var
{
how
}
is
\co
de
{
2
}
, further sends
\co
nstant
{
SHUT
_
RD
}
, further receives are disallowed. If
\var
{
how
}
is
\constant
{
SHUT
_
WR
}
,
further sends are disallowed. If
\var
{
how
}
is
\co
nstant
{
SHUT
_
RDWR
}
, further sends
and receives are disallowed.
\end{methoddesc}
...
...
Misc/NEWS
View file @
94681fc4
...
...
@@ -95,6 +95,8 @@ Core and builtins
Extension modules
-----------------
- socket.SHUT_{RD,WR,RDWR} was added.
- os.getsid was added.
- The pwd module incorrectly advertised its struct type as
...
...
Modules/socketmodule.c
View file @
94681fc4
...
...
@@ -2097,8 +2097,8 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
PyDoc_STRVAR
(
shutdown_doc
,
"shutdown(flag)
\n
\
\n
\
Shut down the reading side of the socket (flag ==
0
), the writing side
\n
\
of the socket (flag ==
1), or both ends (flag == 2
)."
);
Shut down the reading side of the socket (flag ==
SHUT_RD
), the writing side
\n
\
of the socket (flag ==
SHUT_WR), or both ends (flag == SHUT_RDWR
)."
);
/* List of methods for socket objects */
...
...
@@ -4101,6 +4101,29 @@ init_socket(void)
PyModule_AddIntConstant
(
m
,
"NI_DGRAM"
,
NI_DGRAM
);
#endif
/* shutdown() parameters */
#ifdef SHUT_RD
PyModule_AddIntConstant
(
m
,
"SHUT_RD"
,
SHUT_RD
);
#elif defined(SD_RECEIVE)
PyModule_AddIntConstant
(
m
,
"SHUT_RD"
,
SD_RECEIVE
);
#else
PyModule_AddIntConstant
(
m
,
"SHUT_RD"
,
0
);
#endif
#ifdef SHUT_WR
PyModule_AddIntConstant
(
m
,
"SHUT_WR"
,
SHUT_WR
);
#elif defined(SD_SEND)
PyModule_AddIntConstant
(
m
,
"SHUT_WR"
,
SD_SEND
);
#else
PyModule_AddIntConstant
(
m
,
"SHUT_WR"
,
1
);
#endif
#ifdef SHUT_RDWR
PyModule_AddIntConstant
(
m
,
"SHUT_RDWR"
,
SHUT_RDWR
);
#elif defined(SD_BOTH)
PyModule_AddIntConstant
(
m
,
"SHUT_RDWR"
,
SD_BOTH
);
#else
PyModule_AddIntConstant
(
m
,
"SHUT_RDWR"
,
2
);
#endif
/* Initialize gethostbyname lock */
#if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK)
netdb_lock
=
PyThread_allocate_lock
();
...
...
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