summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Doc/library/ftplib.rst3
-rw-r--r--Doc/library/socket.rst35
-rw-r--r--Doc/library/ssl.rst8
-rw-r--r--Doc/library/telnetlib.rst6
-rw-r--r--Doc/library/urllib.error.rst3
5 files changed, 30 insertions, 25 deletions
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index 087e200424..d13f2f0754 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -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::
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 28108ab951..3d1a6a4d65 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -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.
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index 4b9aa09c7b..9f3760e87a 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -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
diff --git a/Doc/library/telnetlib.rst b/Doc/library/telnetlib.rst
index 646634db7c..9bc79c5154 100644
--- a/Doc/library/telnetlib.rst
+++ b/Doc/library/telnetlib.rst
@@ -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()
diff --git a/Doc/library/urllib.error.rst b/Doc/library/urllib.error.rst
index 282329fe5d..793d3e2b1a 100644
--- a/Doc/library/urllib.error.rst
+++ b/Doc/library/urllib.error.rst
@@ -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