From d840e5174dc8d5407b56e377aa1e608ebe5cf535 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 4 Feb 2010 20:20:18 +0000 Subject: 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. --- Misc/NEWS | 5 +++++ Modules/socketmodule.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index b0db1c7..796c3a7 100644 --- 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 diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 396a43d..a993e88 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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; } -- cgit v0.12