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
465db3c6
Commit
465db3c6
authored
Jul 26, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
socketmodule.c: backport INVALID_SOCKET from Python 3.5 to simplify the code
parent
5a1427c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
14 deletions
+5
-14
Modules/socketmodule.c
Modules/socketmodule.c
+5
-14
No files found.
Modules/socketmodule.c
View file @
465db3c6
...
...
@@ -94,6 +94,10 @@ Local naming conventions:
#include "structmember.h"
#include "timefuncs.h"
#ifndef INVALID_SOCKET
/* MS defines this */
#define INVALID_SOCKET (-1)
#endif
#undef MAX
#define MAX(x, y) ((x) < (y) ? (y) : (x))
...
...
@@ -1705,11 +1709,7 @@ sock_accept(PySocketSockObject *s)
return
NULL
;
memset
(
&
addrbuf
,
0
,
addrlen
);
#ifdef MS_WINDOWS
newfd
=
INVALID_SOCKET
;
#else
newfd
=
-
1
;
#endif
if
(
!
IS_SELECTABLE
(
s
))
return
select_error
();
...
...
@@ -1727,11 +1727,7 @@ sock_accept(PySocketSockObject *s)
}
END_SELECT_LOOP
(
s
)
#ifdef MS_WINDOWS
if
(
newfd
==
INVALID_SOCKET
)
#else
if
(
newfd
<
0
)
#endif
return
s
->
errorhandler
();
/* Create the new object with unspecified family,
...
...
@@ -3185,12 +3181,7 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
fd
=
socket
(
family
,
type
,
proto
);
Py_END_ALLOW_THREADS
#ifdef MS_WINDOWS
if
(
fd
==
INVALID_SOCKET
)
#else
if
(
fd
<
0
)
#endif
{
if
(
fd
==
INVALID_SOCKET
)
{
set_error
();
return
-
1
;
}
...
...
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