diff Modules/socketmodule.c @ 38476:d3383063491f legacy-trunk

Fix refleak in socketmodule. Replace bogus Py_BuildValue calls. Fix refleak in exceptions.
author Georg Brandl <georg@python.org>
date Mon, 29 May 2006 09:46:51 +0000
parents 36cd4a4ab8f7
children 3fe3ccdf0155
line wrap: on
line diff
--- a/Modules/socketmodule.c	Sun May 28 22:38:57 2006 +0000
+++ b/Modules/socketmodule.c	Mon May 29 09:46:51 2006 +0000
@@ -2472,7 +2472,7 @@
 
 	/* Return the number of bytes read and the address.  Note that we do
 	   not do anything special here in the case that readlen < recvlen. */
-	ret = PyTuple_Pack(2, PyInt_FromLong(readlen), addr);
+	ret = Py_BuildValue("lO", readlen, addr);
 	
 finally:
 	Py_XDECREF(addr);
@@ -4364,8 +4364,10 @@
 	PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO);
 #endif
 	PyModule_AddIntConstant(m, "BTPROTO_RFCOMM", BTPROTO_RFCOMM);
-	PyModule_AddObject(m, "BDADDR_ANY", Py_BuildValue("s", "00:00:00:00:00:00"));
-	PyModule_AddObject(m, "BDADDR_LOCAL", Py_BuildValue("s", "00:00:00:FF:FF:FF"));
+	PyModule_AddObject(m, "BDADDR_ANY",
+	                   PyString_FromString("00:00:00:00:00:00"));
+	PyModule_AddObject(m, "BDADDR_LOCAL",
+	                   PyString_FromString("00:00:00:FF:FF:FF"));
 #endif
 
 #ifdef HAVE_NETPACKET_PACKET_H