Serhiy Storchaka
228b12edcc
Issue #28999 : Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible. Patch is writen with Coccinelle.
9 years ago
Gregory P. Smith
8128d5a491
Address a minor Coverity warning re: unchecked PyArg_ParseTuple calls
in socket.sendto(). A PyErr_Occurred() check was happening later, but
it is better to just use the return value and not call PyErr_Occurred().
9 years ago
Victor Stinner
11dd6048aa
Add TCP_CONGESTION and TCP_USER_TIMEOUT
Issue #26273 : Add new socket.TCP_CONGESTION (Linux 2.6.13) and
socket.TCP_USER_TIMEOUT (Linux 2.6.37) constants.
Patch written by Omar Sandoval.
9 years ago
Victor Stinner
4f8dc3d15c
Add TCP_CONGESTION and TCP_USER_TIMEOUT
Issue #26273 : Add new socket.TCP_CONGESTION (Linux 2.6.13) and
socket.TCP_USER_TIMEOUT (Linux 2.6.37) constants.
Patch written by Omar Sandoval.
9 years ago
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
UTF-8 represenatation of Unicode objects.
9 years ago
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
9 years ago
Martin Panter
c9e08d8cb5
Issue #28000 : Fix gethostbyname_r() usage on AIX with _LINUX_SOURCE_COMPAT
Patch by Matthieu S.
9 years ago
Martin Panter
fa27d5f229
Issue #28480 : Avoid label at end of compound statement --without-threads
Based on patch by Masayuki Yamamoto.
9 years ago
Yury Selivanov
fa22b29960
Issue #28471 : Fix crash (GIL state related) in socket.setblocking
9 years ago
Serhiy Storchaka
6a7d3480fc
Issue #28332 : Deprecated silent truncations in socket.htons and socket.ntohs.
Original patch by Oren Milman.
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.
10 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