[Python-checkins] r46519 - in python/trunk: Modules/socketmodule.c Objects/exceptions.c

georg.brandl python-checkins at python.org
Mon May 29 11:46:52 CEST 2006


Author: georg.brandl
Date: Mon May 29 11:46:51 2006
New Revision: 46519

Modified:
   python/trunk/Modules/socketmodule.c
   python/trunk/Objects/exceptions.c
Log:
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
Fix refleak in exceptions.



Modified: python/trunk/Modules/socketmodule.c
==============================================================================
--- python/trunk/Modules/socketmodule.c	(original)
+++ python/trunk/Modules/socketmodule.c	Mon May 29 11:46:51 2006
@@ -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

Modified: python/trunk/Objects/exceptions.c
==============================================================================
--- python/trunk/Objects/exceptions.c	(original)
+++ python/trunk/Objects/exceptions.c	Mon May 29 11:46:51 2006
@@ -246,6 +246,7 @@
     }
     seq = PySequence_Tuple(val);
     if (!seq) return -1;
+    Py_CLEAR(self->args);
     self->args = seq;
     return 0;
 }


More information about the Python-checkins mailing list