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
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.
2016-01-28 15:41:01 +01:00
Raymond Hettinger
1ce6885f8a
Fix compiler warning about obviously unreachable code.
2016-01-24 22:15:20 -08:00
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
2015-12-25 20:01:53 +02:00
Victor Stinner
bc5b80bac1
Close #24784 : Fix compilation without thread support
...
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
2015-10-11 09:54:42 +02:00
Victor Stinner
92f0113701
Close #24784 : Fix compilation without thread support
...
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
2015-10-11 09:54:42 +02:00
Victor Stinner
f9fdfa7c4e
Merge 3.4
2015-09-11 12:38:17 +02:00
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.
2015-09-11 12:37:30 +02:00
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.
2015-07-27 23:37:11 +02:00
Larry Hastings
a6cc551502
Issue #22631 : Added Linux-specific socket constant CAN_RAW_FD_FRAMES.
...
Patch courtesy of Joe Jevnik.
2015-04-13 17:48:40 -04:00
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().
2015-04-09 10:27:25 +02:00
Victor Stinner
88ed640fc7
Issue #23834 : Fix the default socket timeout
...
Use -1 second by default, not -1 nanosecond.
2015-04-09 10:23:12 +02:00
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)!
2015-04-06 22:30:41 +02:00
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.
2015-04-06 23:16:34 +02:00
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().
2015-04-06 23:06:01 +02:00
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.
2015-04-03 13:22:27 +02:00
Victor Stinner
a135cb8143
Issue #23618 : Ooops, remove abort() added for debug purpose
2015-04-02 15:17:12 +02:00