diff options
-rw-r--r-- | Misc/NEWS | 5 | ||||
-rw-r--r-- | Modules/socketmodule.c | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -242,6 +242,11 @@ C-API 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 fa543cd..e65303b 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; } |