Commit Graph

747 Commits

Author SHA1 Message Date
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
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.
2015-04-02 14:37:20 +02:00
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.
2015-04-02 11:50:57 +02:00
Victor Stinner 35bee932e4 Issue #23618: Don't declare recvmsg/sendmsg helper functions on Windows 2015-04-02 12:28:07 +02:00
Victor Stinner ff444e828e Issue #23834: Fix sock_call(), set deadline_initialized to recompute the timeout 2015-04-02 03:22:49 +02:00
Victor Stinner 02f32ab47e Issue #23834: Modify socket.sendall() to reuse sock_call() with
sock_send_impl()
2015-04-01 22:53:26 +02:00
Victor Stinner 31bf2d5073 Issue #23834: Add sock_call() helper function
The BEGIN_SELECT_LOOP and END_SELECT_LOOP macros of socketmodule.c don't handle
EINTR. Functions using these macros use an inner loop to handle EINTR, but they
don't recompute the timeout.

This changes replaces the two macros with a new sock_call() function which
takes a function as a parameter. sock_call() recomputes the timeout, handle
false positive and handle EINTR.
2015-04-01 21:57:09 +02:00
Benjamin Peterson 81541f4480 merge 3.4 2015-04-01 12:37:34 -04:00
Benjamin Peterson 4fd929b431 remove assignment in conditional 2015-04-01 11:16:40 -04:00
Victor Stinner a772662423 Issue #23618: Fix EINTR handling on Windows
Windows uses WSAEINTR error code, not EINTR, for socket functions.
2015-04-01 11:09:43 +02:00
Victor Stinner 70a46f635f Issue #23618: Enhance EINTR handling in socket.connect()
Call PyErr_CheckSignals() immediatly if connect() or select() fails with EINTR
in internal_connect().

Refactor also the code to limit indentaton and make it more readable.
2015-03-31 22:03:59 +02:00
Victor Stinner ee699e9d2b Issue #23618: Fix EINTR handling in socket.connect()
Call PyErr_CheckSignals() if connect(), select() or getsockopt() failed with
EINTR.
2015-03-31 21:28:42 +02:00
Victor Stinner c4e819a54f Issue #23618: Cleanup internal_connect() in socketmodule.c
On Windows, it looks like using the C type socklen_t for getsockopt() (instead
of int) is fine, it was already used in socket.getsockopt().
2015-03-31 21:23:10 +02:00
Victor Stinner b6c15bcad3 Issue #23618: Refactor internal_connect()
On Windows, internal_connect() now reuses internal_connect_select() and always
calls getsockopt().
2015-03-31 16:35:35 +02:00
Victor Stinner dd88d3db45 Issue #23618: Refactor internal_connect()
The function now returns the error code instead of using the global errno
(POSIX) or WSAGetLastError() (Windows).

internal_connect() now returns errno if getsockopt() fails.
2015-03-31 16:08:22 +02:00
Victor Stinner 1bb0aef4d1 Issue #22117: Fix integer overflow check in socket_parse_timeout() on Windows 2015-03-31 16:31:19 +02:00
Victor Stinner dd83bd2f9c Issue #23618: Fix internal_connect_select() 2015-03-31 14:24:47 +02:00
Victor Stinner 416f2e66ca Issue #23618: internal_connect_select() now waits also for error events 2015-03-31 13:56:29 +02:00
Victor Stinner e6951c6c8a Issue #23618: Refactor internal_select() to prepare socket.connect() for EINTR 2015-03-31 13:50:44 +02:00
Victor Stinner 391fa713f7 Issue #23618: Refactor the _socket module
* Inline internal_select() function
* Rename internal_select_ex() internal_select()
2015-03-31 13:15:31 +02:00
Victor Stinner 869e1778c0 Issue #22117: Replace usage of _PyTime_ROUND_UP with _PyTime_ROUND_CEILING
All these functions only accept positive timeouts, so this change has no effect
in practice.
2015-03-30 03:49:14 +02:00
Victor Stinner ea9c0dd2c2 Issue #22117: Fix usage of _PyTime_AsTimeval()
Add _PyTime_AsTimeval_noraise() function. Call it when it's not possible (or
not useful) to raise a Python exception on overflow.
2015-03-30 02:51:13 +02:00
Victor Stinner 71694d5c8c Issue #22117: The socket module uses _PyTime_t timestamp for timeouts 2015-03-28 01:18:54 +01:00
Victor Stinner b7df3144ef Issue #23618, #22117: refactor socketmodule.c
Move Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS inside internal_select_ex() to
prepare a switch to the _PyTime_t type and retry syscall on EINTR.
2015-03-27 22:59:32 +01:00
Victor Stinner f50e187724 Fix compiler warnings: comparison between signed and unsigned numbers 2015-03-20 11:32:24 +01:00
Serhiy Storchaka 8490f5acfe Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and
codecs, that accepted only read-only bytes-like object now accept writable
bytes-like object too.
2015-03-20 09:00:36 +02:00
Victor Stinner 9a8089b32a Issue #23646: Enhance precision of time.sleep() and socket timeout when
interrupted by a signal

Add a new _PyTime_AddDouble() function and remove _PyTime_ADD_SECONDS() macro.
The _PyTime_ADD_SECONDS only supported an integer number of seconds, the
_PyTime_AddDouble() has subsecond resolution.
2015-03-20 01:42:20 +01:00
Serhiy Storchaka caa01f861c Fixed GCC version testing. 2015-03-05 23:42:24 +02:00
Victor Stinner a4c727131e Fix "GCC diagnostic" in socketmodule.c
Fix regression of changeset 7c6e3358221a on GCC < 4.4. The _socket module
cannot be compiled on "x86 FreeBSD 7.2 3.x" buildbot anymore.
2015-03-05 14:04:03 +01:00
Serhiy Storchaka b48af340b9 Silenced minor GCC warnings. 2015-02-26 15:27:57 +02:00
Serhiy Storchaka 4d0d982985 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:33:32 +02:00
Serhiy Storchaka 1a1ff29659 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:28:22 +02:00
Charles-François Natali 6e6c59b508 Issue #23285: PEP 475 -- Retry system calls failing with EINTR. 2015-02-07 13:27:50 +00:00
Serhiy Storchaka b757c83ec6 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:25:22 +02:00
Steve Dower 65e4cb10d9 Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015), which will be used for the official 3.5 release. 2014-11-22 12:54:57 -08:00
Serhiy Storchaka 92bf919ed0 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:26:10 +02:00
Charles-François Natali ea07eb9469 Issue #22378: socket module: add SO_MARK. 2014-09-18 23:18:46 +01:00
Serhiy Storchaka d8a1447c99 Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
2014-09-06 20:07:17 +03:00
Victor Stinner ae58649721 Issue #22043: time.monotonic() is now always available
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
2014-09-02 23:18:25 +02:00
Victor Stinner 1a62a680d6 Issue #22218: Fix "comparison between signed and unsigned integers" warnings in
socketmodule.c.
2014-08-17 19:33:28 +02:00
Martin v. Löwis 17fd1e1013 Issue #22127: fix typo. 2014-08-05 16:13:50 +02:00
Martin v. Löwis eb1c28a849 Issue #22127: Bypass IDNA for pure-ASCII host names (in particular for numeric IPs). 2014-08-05 16:10:38 +02:00
Victor Stinner 011428e168 (Merge 3.4) Fix repr(_socket.socket) on Windows 64-bit: don't fail with
OverflowError on closed socket. repr(socket.socket) already works fine.
2014-07-26 14:37:57 +02:00
Victor Stinner e254e53c83 Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError
on closed socket. repr(socket.socket) already works fine.
2014-07-26 14:36:55 +02:00
Victor Stinner b6dab6bce8 Issue #22042: Avoid dangerous C cast in socket.setblocking()
Avoid cast from (int*) to (u_long*), even if sizeof(int) == sizeof(u_long).
2014-07-23 22:56:55 +02:00
Berker Peksag d9375f121e Fix typo in socket.getaddrinfo() docstring.
Reported by Krishna Kumar Thakur on docs@.
2014-06-30 11:30:00 +03:00
Berker Peksag a6ec5ee3c8 Fix typo in socket.getaddrinfo() docstring.
Reported by Krishna Kumar Thakur on docs@.
2014-06-30 11:28:40 +03:00
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.
2015-04-02 17:16:08 +02:00
Victor Stinner ef7f140366 All modern compilers provide a offsetof() function
offsetof() is used directly in many other .c files without any issue.
2014-06-03 18:45:05 +02:00
Charles-François Natali 644b8f52a8 Issue #21455: Add a default backlog to socket.listen(). 2014-05-22 19:45:39 +01:00
Vinay Sajip ed6783f315 Issue #10141, Issue 20065: Changed #if to take CAN_RAW into account. 2014-03-21 11:44:32 +00:00
Vinay Sajip ecfc98c67b Issue #10141: updated new usages of AF_CAN to be in #ifdef AF_CAN rather than #ifdef HAVE_LINUX_CAN_H to allow compilation on older Linuxes. 2014-03-20 12:42:42 +00:00
Charles-François Natali 4025ac7549 Issue #20065: socketmodule: Fix build error when AF_CAN is defined without the
proper CAN headers.
2014-02-08 22:54:48 +01:00
Charles-François Natali b4062e8f8a Issue #20065: socketmodule: Fix build error when AF_CAN is defined without the
proper CAN headers.
2014-02-08 22:54:11 +01:00
Benjamin Peterson 901acb4d89 merge 3.3 (#20251) 2014-01-14 00:22:50 -05:00
Benjamin Peterson a677d7628b remove overly strict assertion (closes #20251) 2014-01-14 00:21:49 -05:00
Benjamin Peterson c6b37e21f5 merge 3.3 (#20246) 2014-01-13 23:14:42 -05:00
Benjamin Peterson 5688222907 merge 3.2 (#20246) 2014-01-13 23:12:55 -05:00
Benjamin Peterson fbf648ebba complain when nbytes > buflen to fix possible buffer overflow (closes #20246) 2014-01-13 22:59:38 -05:00
Brett Cannon b05cbe61b3 Issue #12837: Silence a Clang compiler warning on OS X.
Now makes CPython build without warnings on OS X under Clang with
-Wno-unused-value -Wno-empty-body -Qunused-arguments
-Wno-deprecated-declarations.

Thanks to David Watson for taking an initial stab at a solution.
2014-01-07 17:01:01 -05:00
Christian Heimes af01f66817 Issue #16136: Remove VMS support and VMS-related code 2013-12-21 16:19:10 +01:00
Guido van Rossum 638aebd58e Fix broken docstring continuation line for detach(). 2013-12-04 11:50:09 -08:00
Victor Stinner 9a954838ab Close #19827: On UNIX, setblocking() and settimeout() methods of socket.socket
can now avoid a second syscall if the ioctl() function can be used, or if the
non-blocking flag of the socket is unchanged.
2013-12-04 00:41:24 +01:00
Benjamin Peterson 1314ef73d0 add SO_PRIORITY (closes #19802)
Patch by Claudiu Popa.
2013-11-27 09:18:54 -06:00
Victor Stinner e990c6e952 Fix sock_recvfrom_guts(): recvfrom() size is limited to an int on Windows, not
on other OSes!
2013-11-16 00:18:58 +01:00
Jason R. Coombs 8ec784c2df Issue #7171: Update syntax to replace MAX in favor of Py_MAX (matching implementation for Unix). 2013-11-10 13:43:22 -05:00
Serhiy Storchaka 9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Christian Heimes 9228837e31 Issue #18549: Eliminate dead code in socket_ntohl().
CID 982369
2013-07-25 11:46:10 +02:00
Christian Heimes d2774c7d09 Issue #18259: Declare sethostname in socketmodule.c for AIX 2013-06-19 02:06:29 +02:00
Ronald Oussoren a822d36675 Ensure that the fix for #17269 also works on OSX 10.4
AI_NUMERICSERV isn't defined on OSX 10.4.
2013-06-10 10:36:28 +02:00
Victor Stinner a534fc4b3b Close #18109: os.uname() now decodes fields from the locale encoding, and
socket.gethostname() now decodes the hostname from the locale encoding, instead
of using the UTF-8 encoding in strict mode.
2013-06-03 22:07:27 +02:00
Ronald Oussoren 27a4ac535f Issue #17269: Workaround for a platform bug in getaddrinfo on OSX
Without this patch socket.getaddrinfo crashed when called
with some unusual argument combinations.
2013-05-24 13:47:37 +02:00
Benjamin Peterson 18b7191653 C89 declaration compliance 2013-05-16 15:29:44 -05:00
Terry Jan Reedy 0f84764a09 Issue #17047: remove doubled words added in 3.3
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 18:34:00 -04:00
Antoine Pitrou c73c561181 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
2013-02-09 23:14:42 +01:00
Antoine Pitrou 4de7457009 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag).
2013-02-09 23:11:27 +01:00
Serhiy Storchaka 9101e23ff6 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:41:45 +02:00
Serhiy Storchaka 441d30fac7 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:26:26 +02:00
Christian Heimes 15b6885fe0 Make sure that *really* no more than sizeof(ifr.ifr_name) chars are strcpy-ed to ifr.ifr_name and that the string is *always* NUL terminated. New code shouldn't use strcpy(), too. CID 719692 2012-09-10 01:25:50 +02:00
Andrew Svetlov c53eb9dfe2 Merge 3.2 to default 2012-08-14 18:42:10 +03:00
Matthias Klose d182a6c77e Modules/socketmodule.c: netdb_lock: define static. 2012-08-14 17:29:04 +02:00
Atsuo Ishimoto da0fc14d46 Issue #7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` to socket module. 2012-07-16 15:16:54 +09:00
Georg Brandl 6083a4bc1c Re #18521: remove assignments of variables that are immediately reassigned. 2013-10-14 06:51:46 +02:00
Charles-François Natali 0cc86850b6 Issue #16201: socket: Use inet_pton()/inet_addr() instead of ad-hoc parsing for
numeric IP addresses.
2013-09-13 19:53:08 +02:00
Charles-François Natali 24aa041731 Use INADDR_BROADCAST instead of hard-coded value (it's part of POSIX and
already appears without #ifdef a couple lines above).
2013-08-31 14:48:25 +02:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Serhiy Storchaka 46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Christian Heimes 7c8cd257e4 Issue #18549: Eliminate dead code in socket_ntohl().
CID 982369
2013-07-25 11:47:25 +02:00
Victor Stinner 14b9b11098 If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified. 2013-06-25 00:37:25 +02:00
Victor Stinner 9a644b23cc Issue #9566: recv(), recvfrom(), send(), sendall() and sendto() methods
of socket.socket objects now truncate the input buffer to INT_MAX bytes on
Windows to avoid an integer overflow.

(sendall() still send the whole buffer.)
2013-06-24 23:47:41 +02:00
Christian Heimes 71515510d8 Issue #18259: Declare sethostname in socketmodule.c for AIX 2013-06-19 02:07:20 +02:00
Ronald Oussoren 36451f076b (3.3->default) Ensure that the fix for #17269 also works on OSX 10.4
AI_NUMERICSERV isn't defined on OSX 10.4.
2013-06-10 10:37:12 +02:00
Victor Stinner 640c35ce13 Reuse Py_MIN and Py_MAX macros: remove duplicate MIN/MAX macros
multiprocessing.h: remove unused MIN and MAX macros
2013-06-04 23:14:37 +02:00
Victor Stinner 0b81111b18 (Merge 3.3) Close #18109: os.uname() now decodes fields from the locale
encoding, and socket.gethostname() now decodes the hostname from the locale
encoding, instead of using the UTF-8 encoding in strict mode.
2013-06-03 22:09:14 +02:00
Ronald Oussoren dc3e6cc452 (3.3->default) Issue #17269: Workaround for a platform bug in getaddrinfo on OSX
Without this patch socket.getaddrinfo crashed when called
with some unusual argument combinations.
2013-05-24 13:51:21 +02:00
Giampaolo Rodola' 80e1c43ddf Fix issue #17996: expose socket.AF_LINK constant on BSD and OSX. 2013-05-21 21:02:04 +02:00
Charles-François Natali b10c71daa2 Backed out changeset c0f2b038fc12 2013-05-21 10:45:46 +02:00
Charles-François Natali c7c333d25d Issue #17683: socket module: return AF_UNIX addresses in Linux abstract
namespace as string.
2013-05-21 09:49:18 +02:00
Charles-Francois Natali 74ca886788 Issue #17917: Use PyModule_AddIntMacro() instead of PyModule_AddIntConstant()
when applicable.
2013-05-20 19:13:19 +02:00
Benjamin Peterson aa96588399 merge 3.3 2013-05-16 15:30:09 -05:00
Terry Jan Reedy 8b53559a89 Merge with 3.3, issue #17047: remove doubled words added in 3.3,
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 18:36:38 -04:00
Charles-François Natali 773e42dff8 Issue #15359: Add CAN_BCM protocol support to the socket module. Patch by Brian
Thorne.
2013-02-05 19:42:01 +01:00
Serhiy Storchaka 7898043868 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
2013-01-15 01:12:17 +02:00
Andrew Svetlov 0832af6628 Issue #16717: get rid of socket.error, replace with OSError 2012-12-18 23:10:48 +02:00
Benjamin Peterson 57b667261c expose TCP_FASTOPEN and MSG_FASTOPEN 2012-12-12 22:24:47 -05:00
Jesus Cea 14c81aba50 #16135: Removal of OS/2 support (Modules/*) 2012-10-05 02:11:36 +02:00
Charles-François Natali f8f5237b2f Remove useless test (flowinfo is unsigned). 2012-06-23 10:26:54 +02:00
Charles-François Natali 9b0c006eb0 Remove useless test (flowinfo is unsigned). 2012-06-23 10:17:05 +02:00
Kristján Valur Jónsson 10f383a937 Issue #14310: inter-process socket duplication for windows 2012-04-07 11:23:31 +00:00
Antoine Pitrou 9a54a260de Issue #14300: Under Windows, sockets created using socket.dup() now allow overlapped I/O.
Patch by sbt.
2012-04-01 01:14:39 +02:00
Kristján Valur Jónsson 310052c1f0 Fix warning when compiling socketmodule.c with VS2010
VS2010 defineds the old errno constants in addition to the WSA* ones.
2012-03-31 13:35:00 +00:00
Ross Lagerwall 8c159761de Issue #10951: Fix warnings in the socket module. 2012-03-06 21:36:18 +02:00
Martin v. Löwis 9d6c66933a Issue #13777: Add PF_SYSTEM sockets on OS X.
Patch by Michael Goderbauer.
2012-02-03 17:44:58 +01:00
Charles-François Natali 366999a011 Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by
Vilmos Nebehaj.
2012-01-02 15:47:29 +01:00
Charles-François Natali 42663334cd Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by
Vilmos Nebehaj.
2012-01-02 15:57:30 +01:00
Charles-François Natali 8b759655d0 Issue #8623: Fix some strict-aliasing warnings. Patch by David Watson. 2011-12-23 16:44:51 +01:00
Charles-François Natali 564a42c8de Issue #12809: Expose IP_TRANSPARENT in the socket module. Patch by Michael
Farrell.
2011-12-17 14:59:56 +01:00
Victor Stinner 1f33f2b0c3 Issue #13560: os.strerror() now uses the current locale encoding instead of UTF-8 2011-12-17 04:45:09 +01:00
Antoine Pitrou 6ec29e299b Issue #8373: The filesystem path of AF_UNIX sockets now uses the filesystem
encoding and the surrogateescape error handler, rather than UTF-8.  Patch
by David Watson.
2011-12-16 14:46:36 +01:00
Victor Stinner 9d3b93ba30 Use the new Unicode API
* Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)
 * Replce PyUnicode_FromUnicode(str, len) by PyUnicode_FromWideChar(str, len)
 * Replace Py_UNICODE by wchar_t
 * posix_putenv() uses PyUnicode_FromFormat() to create the string, instead
   of PyUnicode_FromUnicode() + _snwprintf()
2011-11-22 02:27:30 +01:00
Victor Stinner 74168975cc socket_gethostname() uses a wchar_t* with PyMem_Malloc() to avoid the
old Unicode API.
2011-11-17 01:11:36 +01:00
Charles-François Natali 10b8cf4455 Issue #7777: socket: Add Reliable Datagram Sockets (PF_RDS) support. 2011-11-10 19:21:37 +01:00
Victor Stinner cb98bed299 Issue #12619: Expose socket.SO_BINDTODEVICE constant 2011-10-25 13:45:48 +02:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +02:00
Martin v. Löwis afe55bba33 Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Charles-François Natali 30589c9041 Issue #10141: fix socketmodule compilation on Linux systems with <linux/can.h>
but without AF_CAN definition.
2011-10-07 22:47:08 +02:00
Charles-François Natali 47413c1171 Issue #10141: socket: add SocketCAN (PF_CAN) support. Initial patch by Matthias
Fuchs, updated by Tiago Gonçalves.
2011-10-06 19:47:44 +02:00
Victor Stinner 639418812f Use the new Py_ARRAY_LENGTH macro 2011-09-29 00:42:28 +02:00
Charles-François Natali 466517df0e Issue #12837: POSIX.1-2008 allows socklen_t to be a signed integer: re-enable
the check against negative values, and add a note on this surprising test.
Patch by David Watson.
2011-08-28 18:23:43 +02:00
Charles-François Natali ac7e9e058d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
2011-08-28 18:10:27 +02:00
Charles-François Natali aa26b27503 Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
greater than FD_SETSIZE.
2011-08-28 17:51:43 +02:00
Charles-François Natali e9e95ae93d sock_sendmsg/sock_recvmsg: Use {0} to 0-initialize aggregate types with
automatic storage class.
2011-08-24 21:40:53 +02:00
Charles-François Natali b09f25e9a3 Issue12810: Remove check for negative unsigned value in socketmodule.c. Patch
by Joel Stanley.
2011-08-24 20:07:54 +02:00
Victor Stinner 710d27e93a Close #12826: fix socketmodule.c for OpenBSD, include sys/uio.h
Patch written by Remi Pointel.
2011-08-23 10:57:32 +02:00
Nick Coghlan 4ecf6cfc20 Attempt to address Windows buildbot failures 2011-08-22 15:45:19 +10:00
Nick Coghlan 96fe56abec Add support for the send/recvmsg API to the socket module. Patch by David Watson and Heiko Wundram. (Closes #6560) 2011-08-22 11:55:57 +10:00
Ezio Melotti 7ec7fc4c3b #12725: merge with 3.2. 2011-08-14 08:29:49 +03:00
Ezio Melotti 388c945e97 #12725: fix working. Patch by Ben Hayden. 2011-08-14 08:28:57 +03:00
Gregory P. Smith d64b2bae9b merge heads. 2011-06-04 23:05:19 -07:00
Victor Stinner 77af172914 socket.sendto(): exit directly after setting the error
Dummy change to avoid a false positive with the Clang Static Analyzer.
2011-05-26 14:05:59 +02:00
Gregory P. Smith b6471db8a7 Further documentation updates to be consistent with doc standards and comments
Ezio Melotti pointed out.
2011-05-22 22:47:55 -07:00
Charles-François Natali 6071359de1 Issue #1746656: make if_nameindex(), if_indextoname() and if_nametoindex()
accept and return str instead of bytes arrays. Add some more tests.
2011-05-20 16:55:06 +02:00
Gregory P. Smith 3b1f2c35f4 issue #1746656: Fix for OS X. configure and #include changes so that the socket
module compiles again on OS X with its more annoying #include requirements.
2011-05-15 12:18:23 -07:00
Gregory P. Smith 5ed2e779f1 Issue #1746656: Add if_nameindex, if_nametoindex, if_indextoname
methods to the socket module.
2011-05-15 00:26:45 -07:00
Antoine Pitrou 3cade9942e Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in
order to accept exactly one connection.  Patch by Daniel Evers.
2011-05-10 19:19:13 +02:00
Antoine Pitrou 1be815aac4 Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in
order to accept exactly one connection.  Patch by Daniel Evers.
2011-05-10 19:16:29 +02:00
Antoine Pitrou 9befeb3743 Issue #5421: merge fix 2011-03-17 22:40:18 +01:00
Antoine Pitrou 5e98141f9f Issue #5421: Fix misleading error message when one of socket.sendto()'s
arguments has the wrong type.  Patch by Nikita Vetoshkin.
2011-03-17 22:38:37 +01:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Ezio Melotti 13925008dc #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 11:05:33 +02:00
Antoine Pitrou fee6684f3c Issue #5421: merge fix 2011-03-17 22:46:17 +01:00
Ezio Melotti b88ed1549e #11565: Merge with 3.2. 2011-03-16 11:38:59 +02:00
Jesus Cea 736e7fc0f6 Issue #11495: OSF support is eliminated. It was deprecated in Python 3.2 2011-03-14 17:36:54 +01:00
Antoine Pitrou 061cfb5258 Issue #10866: Add socket.sethostname(). Initial patch by Ross Lagerwall. 2011-02-28 22:25:22 +00:00
Brett Cannon b94767ff44 Issue #8914: fix various warnings from the Clang static analyzer v254. 2011-02-22 20:15:44 +00:00
Alexander Belopolsky e239d23e8c Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL 2010-12-08 23:31:48 +00:00
Antoine Pitrou c4df784514 Issue #10272: The ssl module now raises socket.timeout instead of a generic
SSLError on socket timeouts.
2010-12-03 19:59:41 +00:00
Hirokazu Yamamoto 09fff7a8d1 Fixed socket_gethostname() on windows. 2010-11-05 17:24:13 +00:00
Benjamin Peterson e857b29fdd plug refleak 2010-10-29 21:37:26 +00:00
Martin v. Löwis 72f48422e2 Issue #9377: Use Unicode API for gethostname on Windows. 2010-10-29 18:20:08 +00:00
Antoine Pitrou e033e06db0 Issue #10093: ResourceWarnings are now issued when files and sockets are
deallocated without explicit closing.  These warnings are silenced by
default, except in pydebug mode.
2010-10-29 10:38:18 +00:00
Antoine Pitrou 323dd70b48 Merged revisions 85868 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85868 | antoine.pitrou | 2010-10-27 22:13:57 +0200 (mer., 27 oct. 2010) | 3 lines

  Issue #8852: Allow the socket module to build on OpenSolaris.
........
2010-10-27 20:27:14 +00:00
Antoine Pitrou b156a46b26 Issue #8852: Allow the socket module to build on OpenSolaris. 2010-10-27 20:13:57 +00:00
Antoine Pitrou 61ec8de809 For now, remove accept4() code (issue #10115) 2010-10-22 18:44:15 +00:00
Gregory P. Smith 397cd8a1fc Merged revisions 85586-85587,85596-85598 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85586 | gregory.p.smith | 2010-10-16 17:17:24 -0700 (Sat, 16 Oct 2010) | 2 lines

  fix for netbsd.
........
  r85587 | gregory.p.smith | 2010-10-16 17:43:10 -0700 (Sat, 16 Oct 2010) | 3 lines

  applying netbsd-wizs-mod.patch from issue5510 -
   fixes for netbsd (and dragonflybsd?)
........
  r85596 | gregory.p.smith | 2010-10-16 19:14:36 -0700 (Sat, 16 Oct 2010) | 6 lines

  Fix multiprocessing Semaphore's on netbsd5. SEM_VALUE_MAX is defined
  as (~0U) on NetBSD which was causing it to appear as -1 when used as
  a signed int for _multprocessing.SemLock.SEM_VALUE_MAX.  This works
  around the problem by substituting INT_MAX on systems where it appears
  negative when used as an int.
........
  r85597 | gregory.p.smith | 2010-10-16 19:57:19 -0700 (Sat, 16 Oct 2010) | 2 lines

  skip test_itimer_virtual on NetBSD to prevent the test suite from hanging.
........
  r85598 | gregory.p.smith | 2010-10-16 20:09:12 -0700 (Sat, 16 Oct 2010) | 2 lines

  Avoid hanging the test on netbsd5.
........
2010-10-17 04:23:21 +00:00
Gregory P. Smith 3e85dfd15e applying netbsd-wizs-mod.patch from issue5510 -
fixes for netbsd (and dragonflybsd?)
2010-10-17 00:43:10 +00:00
Antoine Pitrou b1c5496738 Issue #7523: Add SOCK_CLOEXEC and SOCK_NONBLOCK to the socket module,
where supported by the system.  Patch by Nikita Vetoshkin.
2010-10-14 15:05:38 +00:00
Gregory P. Smith bc5d78d304 Merged revisions 85404 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85404 | gregory.p.smith | 2010-10-12 20:39:47 -0700 (Tue, 12 Oct 2010) | 2 lines

  fix compliation on NetBSD
........
2010-10-13 03:51:16 +00:00
Gregory P. Smith 2501aca628 fix compliation on NetBSD 2010-10-13 03:39:47 +00:00
Antoine Pitrou c8f0196454 Fix compilation under Windows 2010-09-28 22:03:27 +00:00
Antoine Pitrou 3e1fd27b74 Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or EAGAIN,
retry the select() loop instead of bailing out.  This is because select()
can incorrectly report a socket as ready for reading (for example, if it
received some data with an invalid checksum).
2010-09-28 21:23:11 +00:00
Antoine Pitrou 08ae02f11e Merged revisions 85032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85032 | antoine.pitrou | 2010-09-27 19:52:25 +0200 (lun., 27 sept. 2010) | 6 lines

  Issue #9950: Fix socket.sendall() crash or misbehaviour when a signal is
  received.  Now sendall() properly calls signal handlers if necessary,
  and retries sending if these returned successfully, including on sockets
  with a timeout.
........
2010-09-27 18:14:43 +00:00
Antoine Pitrou 6d7df63837 Issue #9950: Fix socket.sendall() crash or misbehaviour when a signal is
received.  Now sendall() properly calls signal handlers if necessary,
and retries sending if these returned successfully, including on sockets
with a timeout.
2010-09-27 17:52:25 +00:00
Daniel Stutzbach ee541e0d81 Merged revisions 84450 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84450 | daniel.stutzbach | 2010-09-03 07:38:33 -0500 (Fri, 03 Sep 2010) | 1 line

  Fix Issue9753: socket.dup() does not always work right on Windows
........
2010-09-03 12:42:06 +00:00
Daniel Stutzbach 6c765284a3 Fix Issue9753: socket.dup() does not always work right on Windows 2010-09-03 12:38:33 +00:00
Martin v. Löwis 112c0f3411 Issue #1027206: getnameinfo is now restricted to numeric addresses as input. 2010-08-25 07:38:15 +00:00
Martin v. Löwis fc0275a14a Issue #1027206: Support IDNA in gethostbyname, gethostbyname_ex and
getaddrinfo. Patch by David Watson.
2010-08-22 19:33:47 +00:00
Antoine Pitrou f72006f442 Merged revisions 84146-84147,84150 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84146 | antoine.pitrou | 2010-08-17 19:55:07 +0200 (mar., 17 août 2010) | 4 lines

  Issue #9612: The set object is now 64-bit clean under Windows.
........
  r84147 | antoine.pitrou | 2010-08-17 20:30:06 +0200 (mar., 17 août 2010) | 3 lines

  Fix <deque iterator>.__length_hint__() under 64-bit Windows.
........
  r84150 | antoine.pitrou | 2010-08-17 21:33:30 +0200 (mar., 17 août 2010) | 3 lines

  Clean some 64-bit issues. Also, always spell "ssize_t" "Py_ssize_t".
........
2010-08-17 19:39:39 +00:00
Antoine Pitrou 19467d27ff Clean some 64-bit issues. Also, always spell "ssize_t" "Py_ssize_t". 2010-08-17 19:33:30 +00:00
Giampaolo Rodolà ccfb91c89f fix issue #8866: parameters passed to socket.getaddrinfo can now be specified as single keyword arguments. 2010-08-17 15:30:23 +00:00
Antoine Pitrou 6e451df800 Followup to r83869 and issue #8524: rename socket.forget() to socket.detach()
and make it return the file descriptor.
2010-08-09 20:39:54 +00:00