47 Commits

Author SHA1 Message Date
Georg Brandl
f9129b47b6 Patch #1466993: remove wrong comment in socket.py
(backport from rev. 43746)
2006-04-09 14:28:16 +00:00
Brett Cannon
e3fa0611a9 Fix test_socket's test for socket.getfqdn() to also accept the result from
socket.gethostname() as a valid return value.

Also clarified the docs as they were a little hazy on the subject matter.
2005-03-12 06:15:56 +00:00
Dave Cole
331708b226 Patch #1003700: Add socketpair function to socket module. 2004-08-09 04:51:41 +00:00
Raymond Hettinger
027bb633b6 Add weakref support to sockets and re pattern objects. 2004-05-31 03:09:25 +00:00
Tim Peters
116d83ce71 SF bug 924242: socket._fileobject._getclosed() returns wrong value
The .closed property always returned the wrong result.

Bugfix candidate!
2004-03-28 02:20:45 +00:00
Martin v. Löwis
1867f24416 Always unwrap _socketobj in socket.ssl. Revert httplib.py 1.25.
Fixes #754447.
2003-06-14 13:30:53 +00:00
Guido van Rossum
65f8cedd4a I saw errors from _fileobject.__del__ about missing self._sock. This
can happen if __init__ doesn't complete.  Fix it by adding a
try/except to __del__.
2003-05-29 14:36:57 +00:00
Martin v. Löwis
a94568a753 Patch #734231: Update RiscOS support. In particular, correct
riscospath.extsep, and use os.extsep throughout.
2003-05-10 07:36:56 +00:00
Fred Drake
70d566be10 Extract the errno value to use from the errno module if possible. 2003-04-29 19:50:25 +00:00
Skip Montanaro
c689918c94 Regain throughput lost with the _socketobject wrapper. The
throughput-sensitive methods are grabbed from the underlying _socket.socket
object.  Closes SF patch 729293.
2003-04-29 19:27:26 +00:00
Guido van Rossum
47dfa4a89a Patch by Jp Calderone:
- The socket module now provides the functions inet_pton and inet_ntop
  for converting between string and packed representation of IP addresses.
  See SF patch #658327.

This still needs a bit of work in the doc area, because it is not
available on all platforms (especially not on Windows).
2003-04-25 05:48:32 +00:00
Skip Montanaro
89feabc7f5 The socket module now always uses the _socketobject wrapper class, even on
platforms which have dup(2).  The makefile() method is built directly on top
of the socket without duplicating the file descriptor, allowing timeouts to
work properly.  Includes a new test case (urllibnet) which requires the
network resource.

Closes bug 707074.
2003-03-30 04:54:24 +00:00
Guido van Rossum
dbfb12148d On Windows, make sure SocketType is the same as socket. (SF bug
598097)
2002-08-22 17:31:16 +00:00
Tim Peters
d7e8a0dd37 Delete junk attributes left behind by _socketobject class construction. 2002-08-08 20:07:03 +00:00
Guido van Rossum
715f970969 The _socketobject class has no need for a __del__ method: all it did was
to delete the reference to self._sock, and the regular destructor will
do that just fine.  This made some hacks in close() unnecessary.

The _fileobject class still has a __del__ method, because it must flush.
2002-08-08 18:11:36 +00:00
Guido van Rossum
48b7969af8 OK, one more hack: speed up the case of readline() in unbuffered mode.
This is important IMO because httplib reads the headers this way.
2002-08-08 17:34:19 +00:00
Guido van Rossum
fb3deec2fc Another refactoring of read() and readline(), this time based on the
observation that _rbuf could never have more than one string in it.
So make _rbuf a string.  The code branches for size<0 and size>=0
are completely separate now, both in read() and in readline().

I checked for tabs this time. :-)
2002-08-08 17:16:09 +00:00
Guido van Rossum
de7cadec54 Extend __all__ with the exports list of the _ssl module. 2002-08-08 15:25:28 +00:00
Guido van Rossum
7c3b6347e5 Oops, stupid tabs. Sorry again. 2002-08-08 15:22:12 +00:00
Guido van Rossum
c18993f84a Another refactoring. Changed 'socket' from being a factory function
to being a new-style class, to be more similar to the socket class
in the _socket module; it is now the same as the _socketobject class.
Added __slots__.  Added docstrings, copied from the real socket class
where possible.

The _fileobject class is now also a new-style class with __slots__
(though without docstrings).  The mode, name, softspace, bufsize and
closed attributes are properly supported (closed as a property; name
as a class attributes; the softspace, mode and bufsize as slots).
2002-08-08 15:16:20 +00:00
Guido van Rossum
443fec3dd9 Major restructuring of _fileobject. Hopefully several things now work
correctly (the test at least succeed, but they don't test everything yet).

Also fix a performance problem in read(-1): in unbuffered mode, this would
read 1 byte at a time.  Since we're reading until EOF, that doesn't make
sense.  Use the default buffer size if _rbufsize is <= 1.
2002-08-08 01:02:16 +00:00
Guido van Rossum
9ed5ae7331 Replace tabs with spaces. (Sorry!) 2002-08-07 19:03:35 +00:00
Guido van Rossum
e9f6614ea3 "Unbuffered" mode of class _fileobject wasn't actually unbuffered,
and this broke a Zope "pipelining" test which read multiple responses
from the same connection (this attaches a new file object to the
socket for each response).  Added a test for this too.

(I want to do some code cleanup too, but I thought I'd first fix
the problem with as little code as possible, and add a unit test
for this case.  So that's what this checkin is about.)
2002-08-07 15:46:19 +00:00
Tim Peters
6be147541a Restore a full arglist to the socket wrapper, so it supports keyword
arguments correctly too.
2002-07-31 17:48:02 +00:00
Tim Peters
8c3fb874ae For platforms (like Windows) that wrap _socket.socket:
+ Don't change the arglist requirements.
+ Give the wrapper the same docstring as _socket.socket (it didn't
  have any docstring).
2002-07-31 17:32:11 +00:00