Christian Heimes
d37c068e69
Add sockaddr_alg to sock_addr_t ( #234 )
...
sock_addr_t is used to define the minimum size of any socket address on
the stack. Let's make sure that an AF_ALG address always fits. Coverity
complains because in theory, AF_ALG might be larger than any of the other
structs. In practice it already fits.
Closes Coverity CID 1398948, 1398949, 1398950
Signed-off-by: Christian Heimes <christian@python.org>
2017-02-22 12:12:00 +01:00
Maximilian Hils
5ec08cea95
Remove double definition of IPPROTO_IPV6 ( #100 )
...
IPPROTO_IPV6 is already defined further above in the same way.
2017-02-15 01:46:08 +03:00
Serhiy Storchaka
228b12edcc
Issue #28999 : Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
...
possible. Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
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().
2017-01-17 16:54:56 -08:00
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.
2016-11-29 16:55:04 +01:00
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
a98c4a984b
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:40 +02:00
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Martin Panter
5e17ad9716
Merge AIX fixes from 3.6
2016-11-14 05:04:36 +00:00
Martin Panter
f8cebad290
Merge AIX fixes from 3.5 into 3.6
2016-11-14 05:04:12 +00:00
Martin Panter
c9e08d8cb5
Issue #28000 : Fix gethostbyname_r() usage on AIX with _LINUX_SOURCE_COMPAT
...
Patch by Matthieu S.
2016-11-14 04:26:36 +00:00
Martin Panter
812f6e1f23
Issue #28480 : Merge multithreading fixes from 3.6
2016-10-20 05:25:14 +00:00
Martin Panter
fa27d5f229
Issue #28480 : Avoid label at end of compound statement --without-threads
...
Based on patch by Masayuki Yamamoto.
2016-10-20 00:48:23 +00:00
Yury Selivanov
193a360570
Merge 3.6 (issue #28471 )
2016-10-18 16:04:40 -04:00
Yury Selivanov
fa22b29960
Issue #28471 : Fix crash (GIL state related) in socket.setblocking
2016-10-18 16:03:52 -04:00
Serhiy Storchaka
6a7d3480fc
Issue #28332 : Deprecated silent truncations in socket.htons and socket.ntohs.
...
Original patch by Oren Milman.
2016-10-02 12:34:40 +03:00
Martin Panter
d508d00919
Issue #28139 : Merge indentation fixes from 3.5 into 3.6
2016-09-17 07:59:14 +00:00
Martin Panter
6d57fe1c23
Issue #28139 : Fix messed up indentation
...
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 03:26:16 +00:00
Christian Heimes
faf2cea1fd
Fix NULL check in sock_sendmsg_iovec. CID 1372885
2016-09-13 10:07:16 +02:00
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
2016-09-12 11:41:58 +02:00
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.
2016-09-12 11:45:59 +02:00
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
2016-09-09 00:28:57 +02:00
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-09-07 12:03:06 +00:00
Benjamin Peterson
b6c345878a
use the '__linux__' instead 'linux' preprocessor define
2016-09-07 14:08:34 -07:00
Christian Heimes
8c21ab0ab9
Issue #27744 : correct comment and markup
2016-09-06 00:07:02 +02:00
Christian Heimes
dffa3949c7
Issue #27744 : Add AF_ALG (Linux Kernel crypto) to socket module.
2016-09-05 23:54:41 +02:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
R David Murray
bdfa0ebff7
#26907 : add some missing getsockopt constants.
...
Patch by Christian Heimes, reviewed by Martin Panter.
2016-08-23 21:12:40 -04:00
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.
2016-08-08 14:07:05 +03:00
Victor Stinner
d3afb62b8f
Merge 3.5 (INVALID_SOCKET)
2016-07-22 17:47:09 +02:00
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
2016-07-22 17:43:59 +02:00
Victor Stinner
5e1989ce89
Merge 3.5 (fix internal_select)
2016-07-22 17:28:55 +02:00
Victor Stinner
0cec877230
socket: Fix internal_select()
...
Bug found by Pavel Belikov ("Fragment N1"):
http://www.viva64.com/en/b/0414/#ID0ECDAE
2016-07-22 17:26:53 +02:00
Martin Panter
b466f8facf
Remove duplicate AF_INET6 addition
2016-06-25 03:06:58 +00:00
Berker Peksag
3583c3bd1d
Issue #26536 : Use spaces instead of tabs
2016-06-18 16:43:25 +03:00
Steve Dower
ea93ac013d
Issue #26536 : socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes.
2016-06-17 12:52:18 -07:00
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.
2016-06-13 16:33:04 +02:00
Stefan Krah
1f9eb879d5
Issue #26857 : The gethostbyaddr_r() workaround is no longer needed with
...
api-level >= 23. Patch by Xavier de Gaye.
2016-05-22 17:35:34 +02:00
Stefan Krah
432dfcf3bc
Issue #26857 : Workaround for missing symbol "gethostbyaddr_r" on Android.
2016-04-26 16:20:17 +02:00
Serhiy Storchaka
21a663ea28
Issue #26057 : Got rid of nonneeded use of PyUnicode_FromObject().
2016-04-13 15:37:23 +03:00
Martin Panter
50ab1a3694
Issue #26685 : Raise OSError if closing a socket fails
2016-04-11 00:38:12 +00:00
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.
2016-03-23 21:35:29 +01:00
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).
2016-03-21 16:36:48 +01:00
Victor Stinner
f664dc5834
ResourceWarning: Revert change on socket and scandir
...
io.FileIO has a safe implementation of destructor, but not socket nor scandir.
2016-03-19 02:01:48 +01:00
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.
2016-03-19 01:03:51 +01:00
Ned Deily
3d2778c8da
Issue #26406 : merge from 3.5
2016-02-23 22:10:06 +11:00
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.
2016-02-23 22:05:29 +11:00
Ned Deily
00538ffe3a
Issue #25924 : merge with 3.5
2016-02-15 16:57:04 +11:00
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.
2016-02-15 16:54:08 +11:00
Victor Stinner
c8d2fb4112
Merge 3.5: Issue #26227
2016-01-28 15:44:10 +01:00