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.
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 @@
}
#endif
+ default:
+ PyErr_SetString(PyExc_ValueError,
+ "Unknown Bluetooth protocol");
+ return NULL;
}
#endif
@@ -1140,7 +1144,7 @@
0,
a->scope);
} else {
- PyErr_SetString(PyExc_TypeError,
+ PyErr_SetString(PyExc_ValueError,
"Invalid address type");
return NULL;
}