diff Modules/socketmodule.c @ 5436:cf818b70da3e legacy-trunk

In makesockaddr(), if we don't know the address family, don't raise an exception -- return it as a tuple. Seems useful in promiscuous mode.
author Guido van Rossum <guido@python.org>
date Wed, 07 May 1997 17:41:48 +0000
parents 5af766a1b531
children 84d3cca814fb
line wrap: on
line diff
--- a/Modules/socketmodule.c	Wed May 07 15:52:12 1997 +0000
+++ b/Modules/socketmodule.c	Wed May 07 17:41:48 1997 +0000
@@ -364,9 +364,12 @@
 	/* More cases here... */
 
 	default:
-		PyErr_SetString(PySocket_Error,
-				"return unknown socket address type");
-		return NULL;
+		/* If we don't know the address family, don't raise an
+		   exception -- return it as a tuple. */
+		return Py_BuildValue("is#",
+				     addr->sa_family,
+				     addr->sa_data,
+				     sizeof(addr->sa_data));
 
 	}
 }