From c9213f5849d50bd5eadd8ba3622644881b47403a Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 4 Feb 2010 20:26:18 +0000 Subject: [PATCH] Merged revisions 77972 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ................ r77972 | antoine.pitrou | 2010-02-04 21:23:24 +0100 (jeu., 04 févr. 2010) | 12 lines Merged revisions 77970 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77970 | antoine.pitrou | 2010-02-04 21:20:18 +0100 (jeu., 04 févr. 2010) | 6 lines 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 d4a136aa0c..9b72293af6 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -79,6 +79,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. + - Issue #6939: Fix file I/O objects in the `io` module to keep the original file position when calling `truncate()`. It would previously change the file position to the given argument, which goes against the tradition of diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 458c88cd60..1a45c5377c 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1053,6 +1053,10 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto) } #endif + default: + PyErr_SetString(PyExc_ValueError, + "Unknown Bluetooth protocol"); + return NULL; } #endif @@ -1104,7 +1108,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; } -- 2.40.0