]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #4772: Raise a ValueError when an unknown Bluetooth protocol is
authorAntoine Pitrou <solipsis@pitrou.net>
Thu, 4 Feb 2010 20:20:18 +0000 (20:20 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Thu, 4 Feb 2010 20:20:18 +0000 (20:20 +0000)
specified, rather than fall through to AF_PACKET (in the `socket` module).
Also, raise ValueError rather than TypeError when an unknown TIPC address
type is specified.  Patch by Brian Curtin.

Misc/NEWS
Modules/socketmodule.c

index b0db1c793d07b1c858c032e6dfaee775543473b0..796c3a7966967c311c90bf9f59dce47b08718dae 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -55,6 +55,11 @@ Core and Builtins
 Library
 -------
 
+- Issue #4772: Raise a ValueError when an unknown Bluetooth protocol is
+  specified, rather than fall through to AF_PACKET (in the `socket` module).
+  Also, raise ValueError rather than TypeError when an unknown TIPC address
+  type is specified.  Patch by Brian Curtin.
+
 - logging: Implemented PEP 391.
 
 - Issue #6939: Fix file I/O objects in the `io` module to keep the original
index 396a43deca6e0b84d24548fea527d4a5974d0d44..a993e886b078149b668772bb50b19e1544b43111 100644 (file)
@@ -1089,6 +1089,10 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
                }
 #endif
 
+               default:
+                       PyErr_SetString(PyExc_ValueError,
+                                       "Unknown Bluetooth protocol");
+                       return NULL;
                }
 #endif
 
@@ -1140,7 +1144,7 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
                                        0,
                                        a->scope);
                } else {
-                       PyErr_SetString(PyExc_TypeError,
+                       PyErr_SetString(PyExc_ValueError,
                                        "Invalid address type");
                        return NULL;
                }