Yury Selivanov
fa22b29960
Issue #28471 : Fix crash (GIL state related) in socket.setblocking
9 years ago
Martin Panter
6d57fe1c23
Issue #28139 : Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
9 years ago
Christian Heimes
faf2cea1fd
Fix NULL check in sock_sendmsg_iovec. CID 1372885
10 years ago
Victor Stinner
52d61e485e
socket: Fix memory leak in sendmsg() and sendmsg_afalg()
Issue #27744 :
* Release msg.msg_iov memory block.
* Release memory on PyMem_Malloc(controllen) failure
10 years ago
Victor Stinner
288b5bf624
Cleanup socketmodule.c
Issue #27744 :
* PEP 7: add {...} around if blocks
* assign variables and then check their value in if() to make the code easier
to read and to debug.
10 years ago
Christian Heimes
0b9d64ebfe
Issue 18550: Check return value of ioctl() / fnctl() in internal_setblocking
The function internal_setblocking() of the socket module did not check
the return values of ioctl() and fnctl().
CID 1294328
10 years ago
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
10 years ago
Benjamin Peterson
b6c345878a
use the '__linux__' instead 'linux' preprocessor define
10 years ago
Christian Heimes
8c21ab0ab9
Issue #27744 : correct comment and markup
10 years ago
Christian Heimes
dffa3949c7
Issue #27744 : Add AF_ALG (Linux Kernel crypto) to socket module.
10 years ago
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
10 years ago
R David Murray
bdfa0ebff7
#26907 : add some missing getsockopt constants.
Patch by Christian Heimes, reviewed by Martin Panter.
10 years ago
Berker Peksag
95e0df8389
Issue #27702 : Only expose SOCK_RAW when defined
SOCK_RAW is marked as optional in the POSIX specification:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
Patch by Ed Schouten.
10 years ago
Victor Stinner
524714eeda
socket: use INVALID_SOCKET
* Replace "fd = -1" with "fd = INVALID_SOCKET"
* Replace "fd < 0" with "fd == INVALID_SOCKET": SOCKET_T is unsigned on Windows
Bug found by Pavel Belikov ("Fragment N1"):
http://www.viva64.com/en/b/0414/#ID0ECDAE
10 years ago
Victor Stinner
0cec877230
socket: Fix internal_select()
Bug found by Pavel Belikov ("Fragment N1"):
http://www.viva64.com/en/b/0414/#ID0ECDAE
10 years ago
Martin Panter
b466f8facf
Remove duplicate AF_INET6 addition
10 years ago
Berker Peksag
3583c3bd1d
Issue #26536 : Use spaces instead of tabs
10 years ago
Steve Dower
ea93ac013d
Issue #26536 : socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes.
10 years ago
doko@ubuntu.com
fcff437de3
- Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants
exposed on the API which are not implemented on GNU/Hurd. They would not
work at runtime anyway.
10 years ago
Stefan Krah
1f9eb879d5
Issue #26857 : The gethostbyaddr_r() workaround is no longer needed with
api-level >= 23. Patch by Xavier de Gaye.
10 years ago
Stefan Krah
432dfcf3bc
Issue #26857 : Workaround for missing symbol "gethostbyaddr_r" on Android.
10 years ago
Serhiy Storchaka
21a663ea28
Issue #26057 : Got rid of nonneeded use of PyUnicode_FromObject().
10 years ago
Martin Panter
50ab1a3694
Issue #26685 : Raise OSError if closing a socket fails
10 years ago
Victor Stinner
cc73932125
socketmodule.c: error if option larger than INT_MAX
On Windows, socket.setsockopt() raises an OverflowError if the socket option is
larger than INT_MAX bytes.
10 years ago
Victor Stinner
19a8e844e4
Add socket finalizer
Issue #26590 : Implement a safe finalizer for the _socket.socket type. It now
releases the GIL to close the socket. Use PyErr_ResourceWarning() to raise the
ResourceWarning to pass the socket object to the warning logger, to get the
traceback where the socket was created (allocated).
10 years ago
Victor Stinner
f664dc5834
ResourceWarning: Revert change on socket and scandir
io.FileIO has a safe implementation of destructor, but not socket nor scandir.
10 years ago
Victor Stinner
914cde89d4
On ResourceWarning, log traceback where the object was allocated
Issue #26567 :
* Add a new function PyErr_ResourceWarning() function to pass the destroyed
object
* Add a source attribute to warnings.WarningMessage
* Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where
source object was allocated.
10 years ago
Ned Deily
e1d4e58777
Issue #26406 : Avoid unnecessary serialization of getaddrinfo(3) calls on
current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis.
10 years ago
Ned Deily
47299fd39c
Issue #25924 : Avoid unnecessary serialization of getaddrinfo(3) calls on OS X
versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis.
10 years ago
Victor Stinner
7240030c52
Windows: Decode hostname from ANSI code page
Issue #26227 : On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex()
functions of the socket module now decode the hostname from the ANSI code page
rather than UTF-8.
10 years ago
Raymond Hettinger
1ce6885f8a
Fix compiler warning about obviously unreachable code.
10 years ago
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
10 years ago
Victor Stinner
bc5b80bac1
Close #24784 : Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
10 years ago
Victor Stinner
92f0113701
Close #24784 : Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
10 years ago
Victor Stinner
ec1a498a01
Issue #24684 : socket.socket.getaddrinfo() now calls
PyUnicode_AsEncodedString() instead of calling the encode() method of the
host, to handle correctly custom string with an encode() method which doesn't
return a byte string. The encoder of the IDNA codec is now called directly
instead of calling the encode() method of the string.
11 years ago
Victor Stinner
bea232a15f
Issue #24732 , #23834 : Fix sock_accept_impl() on Windows
accept() returns INVALID_SOCKET on error, it's not necessary a negative number.
11 years ago
Larry Hastings
a6cc551502
Issue #22631 : Added Linux-specific socket constant CAN_RAW_FD_FRAMES.
Patch courtesy of Joe Jevnik.
11 years ago
Victor Stinner
8e44aa5ae4
Issue #23834 : Fix socket.sendto(), use the C Py_ssize_t type to store the
result of sendto() instead of the C int type.
11 years ago
Benjamin Peterson
4fd929b431
remove assignment in conditional
11 years ago
Victor Stinner
ced1174525
Issue #23618 : Fix internal_select() for negative timeout (blocking socket) when
poll() is not available.
select() doesn't accept negative timeout, the timeout parameter must be NULL to
block on select().
11 years ago
Victor Stinner
88ed640fc7
Issue #23834 : Fix the default socket timeout
Use -1 second by default, not -1 nanosecond.
11 years ago
Victor Stinner
222dfc7d94
Issue #22117 : Fix sock_call_ex() for non-blocking socket
Call internal_select() with a timeout of 0 second, not a timeout of -1 second
(blocking)!
11 years ago
Victor Stinner
8912d1418e
Issue #23853 : socket.socket.sendall() does no more reset the socket timeout
each time data is sent successfuly. The socket timeout is now the maximum total
duration to send all data.
11 years ago
Victor Stinner
9001d8089c
Issue #23834 : Fix initial value of the socket timeout
Use _PyTime_FromSeconds() to initialize the default socket timeout to -1
second, instead of -1 nanosecond which causes rounding issues in
internal_select().
11 years ago
Victor Stinner
10550cdb8a
Issue #23834 : Simplify timeout handling
* Use the new _PyTime_FromSeconds() function to set the timeout to -1 second
for socket.settimeout(None). It avoids a special case in internal_select()
because of a rounding issue: -1 nanosecond is rounded to 0 millisecond which
means non-blocking, instead of blocking.
* Check if the interval the negative in sock_call_ex() instead of doing the
check in internal_select(). sock_call_ex() remembers if the socket has a
timeout or not, which avoids a race condition if the timeout is modified in a
different thread.
11 years ago
Victor Stinner
a135cb8143
Issue #23618 : Ooops, remove abort() added for debug purpose
11 years ago
Victor Stinner
38aec7525e
Issue #23618 : Fix sock_connect_impl(), set the socket error code
sock_call_ex() gets the socket error code when the socket function fails.
sock_connect_impl() didn't set the error correctly.
11 years ago
Victor Stinner
81c41dbfcc
Issue #23618 : socket.socket.connect() now waits until the connection completes
instead of raising InterruptedError if the connection is interrupted by
signals, signal handlers don't raise an exception and the socket is blocking or
has a timeout.
socket.socket.connect() still raise InterruptedError for non-blocking sockets.
11 years ago
Victor Stinner
35bee932e4
Issue #23618 : Don't declare recvmsg/sendmsg helper functions on Windows
11 years ago
Victor Stinner
ff444e828e
Issue #23834 : Fix sock_call(), set deadline_initialized to recompute the timeout
11 years ago