]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Replace mentions of socket.error.
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 12 Oct 2011 15:53:43 +0000 (17:53 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 12 Oct 2011 15:53:43 +0000 (17:53 +0200)
Doc/library/ftplib.rst
Doc/library/socket.rst
Doc/library/ssl.rst
Doc/library/telnetlib.rst
Doc/library/urllib.error.rst

index 087e200424c53f67df1d964acd3047a82bdf8a36..d13f2f0754eabc7ef132047eeec8c966bac5329b 100644 (file)
@@ -144,8 +144,7 @@ The module defines the following items:
    The set of all exceptions (as a tuple) that methods of :class:`FTP`
    instances may raise as a result of problems with the FTP connection (as
    opposed to programming errors made by the caller).  This set includes the
-   four exceptions listed above as well as :exc:`socket.error` and
-   :exc:`IOError`.
+   four exceptions listed above as well as :exc:`OSError`.
 
 
 .. seealso::
index 28108ab9511777a050eabbbf515e947749673b97..3d1a6a4d65a66b489a51184f2a06d30021d0ec5a 100644 (file)
@@ -104,8 +104,9 @@ resolution and/or the host configuration.  For deterministic behavior use a
 numeric address in *host* portion.
 
 All errors raise exceptions.  The normal exceptions for invalid argument types
-and out-of-memory conditions can be raised; errors related to socket or address
-semantics raise :exc:`socket.error` or one of its subclasses.
+and out-of-memory conditions can be raised; starting from Python 3.3, errors
+related to socket or address semantics raise :exc:`OSError` or one of its
+subclasses (they used to raise :exc:`socket.error`).
 
 Non-blocking mode is supported through :meth:`~socket.setblocking`.  A
 generalization of this based on timeouts is supported through
@@ -481,7 +482,7 @@ The module :mod:`socket` exports the following constants and functions:
    Unix manual page :manpage:`inet(3)` for details.
 
    If the IPv4 address string passed to this function is invalid,
-   :exc:`socket.error` will be raised. Note that exactly what is valid depends on
+   :exc:`OSError` will be raised. Note that exactly what is valid depends on
    the underlying C implementation of :c:func:`inet_aton`.
 
    :func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be used
@@ -498,7 +499,7 @@ The module :mod:`socket` exports the following constants and functions:
    argument.
 
    If the byte sequence passed to this function is not exactly 4 bytes in
-   length, :exc:`socket.error` will be raised. :func:`inet_ntoa` does not
+   length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not
    support IPv6, and :func:`inet_ntop` should be used instead for IPv4/v6 dual
    stack support.
 
@@ -512,7 +513,7 @@ The module :mod:`socket` exports the following constants and functions:
 
    Supported values for *address_family* are currently :const:`AF_INET` and
    :const:`AF_INET6`. If the IP address string *ip_string* is invalid,
-   :exc:`socket.error` will be raised. Note that exactly what is valid depends on
+   :exc:`OSError` will be raised. Note that exactly what is valid depends on
    both the value of *address_family* and the underlying implementation of
    :c:func:`inet_pton`.
 
@@ -530,7 +531,7 @@ The module :mod:`socket` exports the following constants and functions:
    Supported values for *address_family* are currently :const:`AF_INET` and
    :const:`AF_INET6`. If the string *packed_ip* is not the correct length for the
    specified address family, :exc:`ValueError` will be raised.  A
-   :exc:`socket.error` is raised for errors from the call to :func:`inet_ntop`.
+   :exc:`OSError` is raised for errors from the call to :func:`inet_ntop`.
 
    Availability: Unix (maybe not all platforms).
 
@@ -596,7 +597,7 @@ The module :mod:`socket` exports the following constants and functions:
 .. function:: sethostname(name)
 
    Set the machine's hostname to *name*.  This will raise a
-   :exc:`socket.error` if you don't have enough rights.
+   :exc:`OSError` if you don't have enough rights.
 
    Availability: Unix.
 
@@ -607,7 +608,7 @@ The module :mod:`socket` exports the following constants and functions:
 
    Return a list of network interface information
    (index int, name string) tuples.
-   :exc:`socket.error` if the system call fails.
+   :exc:`OSError` if the system call fails.
 
    Availability: Unix.
 
@@ -618,7 +619,7 @@ The module :mod:`socket` exports the following constants and functions:
 
    Return a network interface index number corresponding to an
    interface name.
-   :exc:`socket.error` if no interface with the given name exists.
+   :exc:`OSError` if no interface with the given name exists.
 
    Availability: Unix.
 
@@ -629,7 +630,7 @@ The module :mod:`socket` exports the following constants and functions:
 
    Return a network interface name corresponding to a
    interface index number.
-   :exc:`socket.error` if no interface with the given index exists.
+   :exc:`OSError` if no interface with the given index exists.
 
    Availability: Unix.
 
@@ -1182,13 +1183,13 @@ sends traffic to the first one connected successfully. ::
        af, socktype, proto, canonname, sa = res
        try:
            s = socket.socket(af, socktype, proto)
-       except socket.error as msg:
+       except OSError as msg:
            s = None
            continue
        try:
            s.bind(sa)
            s.listen(1)
-       except socket.error as msg:
+       except OSError as msg:
            s.close()
            s = None
            continue
@@ -1217,12 +1218,12 @@ sends traffic to the first one connected successfully. ::
        af, socktype, proto, canonname, sa = res
        try:
            s = socket.socket(af, socktype, proto)
-       except socket.error as msg:
+       except OSError as msg:
            s = None
            continue
        try:
            s.connect(sa)
-       except socket.error as msg:
+       except OSError as msg:
            s.close()
            s = None
            continue
@@ -1294,18 +1295,18 @@ network. This example might require special priviledge::
 
        try:
            s.send(cf)
-       except socket.error:
+       except OSError:
            print('Error sending CAN frame')
 
        try:
            s.send(build_can_frame(0x01, b'\x01\x02\x03'))
-       except socket.error:
+       except OSError:
            print('Error sending CAN frame')
 
 Running an example several times with too small delay between executions, could
 lead to this error::
 
-   socket.error: [Errno 98] Address already in use
+   OSError: [Errno 98] Address already in use
 
 This is because the previous execution has left the socket in a ``TIME_WAIT``
 state, and can't be immediately reused.
index 4b9aa09c7b39e0cdec92774cd71ce74b2cf957ef..9f3760e87aadeb935db3752584da11ce411c6366 100644 (file)
@@ -53,9 +53,11 @@ Functions, Constants, and Exceptions
    (currently provided by the OpenSSL library).  This signifies some
    problem in the higher-level encryption and authentication layer that's
    superimposed on the underlying network connection.  This error
-   is a subtype of :exc:`socket.error`, which in turn is a subtype of
-   :exc:`IOError`.  The error code and message of :exc:`SSLError` instances
-   are provided by the OpenSSL library.
+   is a subtype of :exc:`OSError`.  The error code and message of
+   :exc:`SSLError` instances are provided by the OpenSSL library.
+
+   .. versionchanged:: 3.3
+      :exc:`SSLError` used to be a subtype of :exc:`socket.error`.
 
 .. exception:: CertificateError
 
index 646634db7c723f7f5ec05a55f551c712892003bd..9bc79c515420c4554d457482254b8b5cd02b3760 100644 (file)
@@ -162,9 +162,13 @@ Telnet Objects
 .. method:: Telnet.write(buffer)
 
    Write a byte string to the socket, doubling any IAC characters. This can
-   block if the connection is blocked.  May raise :exc:`socket.error` if the
+   block if the connection is blocked.  May raise :exc:`OSError` if the
    connection is closed.
 
+   .. versionchanged:: 3.3
+      This method used to raise :exc:`socket.error`, which is now an alias
+      of :exc:`OSError`.
+
 
 .. method:: Telnet.interact()
 
index 282329fe5d718a70c6dbd8403d14a7b750e60af1..793d3e2b1a3a1aec63a65be149f8b1e8342cb39f 100644 (file)
@@ -21,8 +21,7 @@ The following exceptions are raised by :mod:`urllib.error` as appropriate:
    .. attribute:: reason
 
       The reason for this error.  It can be a message string or another
-      exception instance (:exc:`socket.error` for remote URLs, :exc:`OSError`
-      for local URLs).
+      exception instance such as :exc:`OSError`.
 
 
 .. exception:: HTTPError