Commit Graph

113 Commits

Author SHA1 Message Date
Serhiy Storchaka a9568bb44a Issue #20604: Added missed invalid mode in error message of socket.makefile().
Based on patch by Franck Michea.
2014-11-19 12:34:07 +02:00
Serhiy Storchaka fca2fc090c Issue #20604: Added missed invalid mode in error message of socket.makefile().
Based on patch by Franck Michea.
2014-11-19 12:33:40 +02:00
Ethan Furman 61358f4622 Issue20689: add missing API pieces to __all__ 2014-10-18 15:11:03 -07:00
Ethan Furman 8e120ac05c Issue20689: add missing API pieces to __all__ 2014-10-18 15:10:49 -07:00
Ethan Furman 41d31967c6 Issue20386: SocketType is again socket.socket; the IntEnum SOCK constants are SocketKind 2014-10-14 18:57:58 -07:00
Ethan Furman 7184bac544 Issue20386: SocketType is again socket.socket; the IntEnum SOCK constants are SocketKind 2014-10-14 18:56:53 -07:00
Charles-François Natali 98c745a773 Issue #18643: Add socket.socketpair() on Windows. 2014-10-14 21:22:44 +01:00
Serhiy Storchaka 521e5860a5 Issue #22032: __qualname__ instead of __name__ is now always used to format
fully qualified class names of Python implemented classes.
2014-07-22 15:00:37 +03:00
Giampaolo Rodola' 915d14190e fix issue #17552: add socket.sendfile() method allowing to send a file over a socket by using high-performance os.sendfile() on UNIX. Patch by Giampaolo Rodola'· 2014-06-11 03:54:30 +02:00
Giampaolo Rodola' b62814998a Provide a more readable representation of socket on repr().
Before:
<socket.socket fd=3, family=2, type=1, proto=0, laddr=('0.0.0.0', 0)>

Now:
<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 0)>
2013-10-03 21:01:43 +02:00
Eli Bendersky b2ff3cf0e9 Switch the AF_* and SOCK_* constants in the socket module to IntEnum.
Closes #18720.
2013-08-31 15:13:30 -07: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
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Giampaolo Rodola' 50331cbf08 Fix issue #17675: make socket repr() provide local and remote addresses (if any). 2013-04-10 15:49:47 +02:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Antoine Pitrou 9b1c84b586 Issue #15842: the SocketIO.{readable,writable,seekable} methods now raise ValueError when the file-like object is closed.
Patch by Alessandro Moura.
2012-09-14 17:30:31 +02:00
Antoine Pitrou 1e7ee9dfa0 Issue #15842: the SocketIO.{readable,writable,seekable} methods now raise ValueError when the file-like object is closed.
Patch by Alessandro Moura.
2012-09-14 17:28:10 +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 8315f96764 Issue #13872: socket.detach() now marks the socket closed (as mirrored in the socket repr()).
Patch by Matt Joiner.
2012-04-01 01:00:55 +02:00
Antoine Pitrou 70deb3de39 Issue #13872: socket.detach() now marks the socket closed (as mirrored in the socket repr()).
Patch by Matt Joiner.
2012-04-01 01:00:17 +02:00
Antoine Pitrou 24d659daaf Use InterruptedError instead of checking for EINTR 2011-10-23 23:49:42 +02:00
Antoine Pitrou 6d58d64919 Issue #11127: Raise a TypeError when trying to pickle a socket object. 2011-03-20 23:56:36 +01:00
Antoine Pitrou 5d5381ed00 Merged revisions 88622 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88622 | antoine.pitrou | 2011-02-26 00:07:44 +0100 (sam., 26 févr. 2011) | 5 lines

  Issue #7322: Trying to read from a socket's file-like object after a timeout
  occurred now raises an error instead of silently losing data.
  Patch by Ross Lagerwall.
........
2011-02-25 23:14:08 +00:00
Antoine Pitrou 68e5c044e8 Issue #7322: Trying to read from a socket's file-like object after a timeout
occurred now raises an error instead of silently losing data.
Patch by Ross Lagerwall.
2011-02-25 23:07:44 +00:00
Antoine Pitrou 600232b562 Issue #7995: When calling accept() on a socket with a timeout, the returned
socket is now always non-blocking, regardless of the operating system.
2011-01-05 21:03:42 +00:00
Victor Stinner c3a51ecb85 Issue #10819: SocketIO.name property returns -1 when its closed, instead of
raising a ValueError, to fix repr().
2011-01-04 11:00:45 +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 834bd81c51 Issue #10041: The signature of optional arguments in socket.makefile()
didn't match that of io.open(), and they also didn't get forwarded
properly to TextIOWrapper in text mode.  Patch by Kai Zhu.
2010-10-13 16:17:14 +00:00
Antoine Pitrou 98b46702d2 Issue #9854: SocketIO objects now observe the RawIOBase interface in
non-blocking mode: they return None when an operation would block (instead
of raising an exception).
2010-09-18 22:59:00 +00:00
Antoine Pitrou 8dd2387a60 Reverted unwanted change in r84826 2010-09-15 11:12:57 +00:00
Antoine Pitrou 5aa0d10560 Improve docs for socket.makefile() and SocketIO 2010-09-15 09:32:45 +00:00
Antoine Pitrou 872b79d02f Add a comment explaining why SocketIO is needed 2010-09-15 08:39:25 +00:00
Antoine Pitrou 9e0b864ac0 Issue #1552: socket.socketpair() now returns regular socket.socket
objects supporting the whole socket API (rather than the "raw"
_socket.socket objects).
2010-09-14 18:00:02 +00:00
Giampaolo Rodolà b383dbb45e Fix issue 9794: adds context manager protocol to socket.socket so that socket.create_connection() can be used with the 'with' statement. 2010-09-08 22:44:12 +00:00
Antoine Pitrou 4b92b5fad3 Issue #9792: In case of connection failure, socket.create_connection()
would swallow the exception and raise a new one, making it impossible
to fetch the original errno, or to filter timeout errors.  Now the
original error is re-raised.
2010-09-07 21:05:49 +00:00
Benjamin Peterson 49203dc9f2 reformat comment 2010-08-31 20:10:55 +00:00
Daniel Stutzbach 19d6a4fd49 Issue #808164: Fixed socket.close to avoid references to globals, to
avoid issues when socket.close is called from a __del__ method.
2010-08-31 20:08:07 +00:00
Benjamin Peterson 34d17debb7 remove SocketIO.__del__; close() can handle it 2010-07-09 18:28:25 +00:00
Gregory P. Smith aafdca895b Merged revisions 74426 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74426 | gregory.p.smith | 2009-08-13 11:54:50 -0700 (Thu, 13 Aug 2009) | 4 lines

  Fix issue1628205: Socket file objects returned by socket.socket.makefile() now
  properly handles EINTR within the read, readline, write & flush methods.
  The socket.sendall() method now properly handles interrupted system calls.
........
2010-01-04 04:50:36 +00:00
Gregory P. Smith b4066374db Merged revisions 77263-77264 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77263 | gregory.p.smith | 2010-01-02 17:29:44 -0800 (Sat, 02 Jan 2010) | 4 lines

  Adds an optional source_address parameter to socket.create_connection().

  For use by issue3972.
........
  r77264 | gregory.p.smith | 2010-01-02 18:06:07 -0800 (Sat, 02 Jan 2010) | 5 lines

  issue3972: HTTPConnection and HTTPSConnection now support a
  source_address parameter.

  Also cleans up an annotation in the socket documentation.
........
2010-01-03 03:28:29 +00:00
Mark Dickinson 5c91bf3e93 Merged revisions 73138 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73138 | mark.dickinson | 2009-06-02 08:39:26 +0100 (Tue, 02 Jun 2009) | 1 line

  Typo in socket.py.  Thanks Pablo Torres Navarrete.
........
2009-06-02 07:41:26 +00:00
Benjamin Peterson ef3e4c2b4d Merged revisions 70980,71059,71225,71234,71241,71243,71249,71251,71255,71266,71299,71329,71397-71398,71486 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70980 | jack.diederich | 2009-04-01 15:26:13 -0500 (Wed, 01 Apr 2009) | 3 lines

  bounds check arguments to mmap.move().  All of them.  Really.
  fixes crasher on OS X 10.5
........
  r71059 | mark.dickinson | 2009-04-02 13:39:37 -0500 (Thu, 02 Apr 2009) | 2 lines

  sys.long_info attributes should be ints, not longs
........
  r71225 | georg.brandl | 2009-04-05 06:54:07 -0500 (Sun, 05 Apr 2009) | 1 line

  #5580: no need to use parentheses when converterr() argument is actually a type description.
........
  r71234 | georg.brandl | 2009-04-05 08:16:35 -0500 (Sun, 05 Apr 2009) | 1 line

  Whitespace normalization.
........
  r71241 | georg.brandl | 2009-04-05 09:48:49 -0500 (Sun, 05 Apr 2009) | 1 line

  #5471: fix expanduser() for $HOME set to "/".
........
  r71243 | georg.brandl | 2009-04-05 10:14:29 -0500 (Sun, 05 Apr 2009) | 1 line

  #5432: make plistlib docstring a raw string, since it contains examples with backslash escapes.
........
  r71249 | georg.brandl | 2009-04-05 11:30:43 -0500 (Sun, 05 Apr 2009) | 1 line

  #5444: adapt make.bat to new htmlhelp output file name.
........
  r71251 | georg.brandl | 2009-04-05 12:17:42 -0500 (Sun, 05 Apr 2009) | 1 line

  #5298: clarify docs about GIL by using more consistent wording.
........
  r71255 | georg.brandl | 2009-04-05 13:34:58 -0500 (Sun, 05 Apr 2009) | 1 line

  #602893: add indicator for current line in cgitb that doesnt rely on styling alone.
........
  r71266 | georg.brandl | 2009-04-05 15:23:13 -0500 (Sun, 05 Apr 2009) | 1 line

  Normalize issue referencing style.
........
  r71299 | gregory.p.smith | 2009-04-05 18:43:58 -0500 (Sun, 05 Apr 2009) | 3 lines

  Fixes issue5705: os.setuid() and friends did not accept the same range of
  values that pwd.getpwnam() returns.
........
  r71329 | benjamin.peterson | 2009-04-06 16:53:33 -0500 (Mon, 06 Apr 2009) | 1 line

  add create_connection to __all__ #5711
........
  r71397 | georg.brandl | 2009-04-08 11:36:39 -0500 (Wed, 08 Apr 2009) | 1 line

  Remove redundant backtick.
........
  r71398 | georg.brandl | 2009-04-08 11:39:04 -0500 (Wed, 08 Apr 2009) | 1 line

  Update ignore file for suspicious builder.
........
  r71486 | andrew.kuchling | 2009-04-11 11:18:14 -0500 (Sat, 11 Apr 2009) | 1 line

  Re-word
........
2009-04-11 19:48:14 +00:00
Gregory P. Smith de3369f2ca Fixes issue #3826 and #4791:
Have SocketIO objects update their reference count in the underlying
socket object on close() so that the underlying socket object is
closed immediately when the last user is done rather than at an
unknown later time when garbage collection can do it.
2009-01-12 04:50:11 +00:00
Benjamin Peterson 44309e6b37 make FileIO.mode always include 'b'
#4386 Reviewed by Amaury
2008-11-22 00:41:45 +00:00
Amaury Forgeot d'Arc 9d24ff027f Follow-up of r67300: correct a failure in socket.makefile().
SocketIO objects now always have 'name' and 'mode' attributes.
2008-11-20 23:15:52 +00:00
Georg Brandl f78e02b798 Merged revisions 63562,63570,63728,63734,63784,63788,63802,63817,63827,63839,63887,63975,63998 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r63562 | martin.v.loewis | 2008-05-23 17:06:50 +0200 (Fri, 23 May 2008) | 2 lines

  Patch #1722225: Support QNX 6.
........
  r63570 | trent.nelson | 2008-05-23 22:33:14 +0200 (Fri, 23 May 2008) | 1 line

  Introduce a user macro named $(externalsDir), which should point to the root directory of where all the external sources should live.  Developers can change this value if their external sources live elsewhere.  The default of '..\..' matches the current status quo.
........
  r63728 | gregory.p.smith | 2008-05-26 23:16:34 +0200 (Mon, 26 May 2008) | 4 lines

  Fix issue2589: there was a potential integer overflow leading to
  memory corruption on esoteric platforms and incorrect behavior on
  normal platforms.
........
  r63734 | gregory.p.smith | 2008-05-27 00:07:28 +0200 (Tue, 27 May 2008) | 3 lines

  Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is
  passed in.  (The assert won't prevent this in non-debug builds).
........
  r63784 | raymond.hettinger | 2008-05-29 10:38:23 +0200 (Thu, 29 May 2008) | 1 line

  Fix two typos.
........
  r63788 | facundo.batista | 2008-05-29 18:39:26 +0200 (Thu, 29 May 2008) | 6 lines


  Fixed the semantic of timeout for socket.create_connection and
  all the upper level libraries that use it, including urllib2.
  Added and fixed some tests, and changed docs correspondingly.
  Thanks to John J Lee for the patch and the pusing, :)
........
  r63802 | mark.dickinson | 2008-05-30 04:46:53 +0200 (Fri, 30 May 2008) | 2 lines

  Fix typo in testSum
........
  r63817 | raymond.hettinger | 2008-05-30 20:20:50 +0200 (Fri, 30 May 2008) | 8 lines

  * Mark intermedidate computes values (hi, lo, yr) as volatile.
  * Expand comments.
  * Swap variable names in the sum_exact code so that x and y
    are consistently chosen as the larger and smaller magnitude
    values respectively.
........
  r63827 | raymond.hettinger | 2008-05-31 05:24:31 +0200 (Sat, 31 May 2008) | 1 line

  Implement heapq in terms of less-than (to match list.sort()).
........
  r63839 | gerhard.haering | 2008-05-31 23:33:27 +0200 (Sat, 31 May 2008) | 2 lines

  Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance.
........
  r63887 | gregory.p.smith | 2008-06-02 06:05:52 +0200 (Mon, 02 Jun 2008) | 4 lines

  Fix issue 2782: be less strict about the format string type in strftime.
  Accept unicode and anything else ParseTuple "s#" can deal with.  This
  matches the time.strftime behavior.
........
  r63975 | neal.norwitz | 2008-06-06 06:47:01 +0200 (Fri, 06 Jun 2008) | 3 lines

  Aldo Cortesi confirmed this is still needed for OpenBSD 4.2 and 4.3.
  (I didn't regen configure, since I don't have a working autoconf.)
........
  r63998 | raymond.hettinger | 2008-06-06 23:47:51 +0200 (Fri, 06 Jun 2008) | 1 line

  Issue 3501: Make heapq support both __le__ and __lt__.
........
2008-06-10 17:40:04 +00:00
Bill Janssen 54cc54c1fe update to fix leak in SSL code 2007-12-14 22:08:56 +00:00
Guido van Rossum 39eb8fa0db This is roughly socket2.diff from issue 1378, with a few changes applied
to ssl.py (no need to test whether we can dup any more).
Regular sockets no longer have a _base, but we still have explicit
reference counting of socket objects for the benefit of makefile();
using duplicate sockets won't work for SSLSocket.
2007-11-16 01:24:05 +00:00
Guido van Rossum 86bc33cb7c Patch 1439 by Bill Janssen. I think this will work.
Tested on Windows by Christian Heimes.
I changed the code slightly, renaming decref_socketios() to
_decref_socketios(), and moving it closer to the close() method
that it calls.  Hopefully Bill can now submit his SSL port to 3.0.
2007-11-14 22:32:02 +00:00