[Python-checkins] python/dist/src/Objects setobject.c,1.42,1.43

rhettinger@users.sourceforge.net rhettinger at users.sourceforge.net
Sat Aug 6 20:31:28 CEST 2005


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5206/Objects

Modified Files:
	setobject.c 
Log Message:
* set_new() doesn't need to zero the structure a second time after tp_alloc
  has already done the job.
* Use a macro form of PyErr_Occurred() inside the set_lookkey() function.



Index: setobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- setobject.c	6 Aug 2005 05:43:39 -0000	1.42
+++ setobject.c	6 Aug 2005 18:31:24 -0000	1.43
@@ -66,7 +66,7 @@
 		if (entry->hash == hash) {
 			/* error can't have been checked yet */
 			checked_error = 1;
-			if (PyErr_Occurred()) {
+			if (_PyErr_OCCURRED()) {
 				restore_error = 1;
 				PyErr_Fetch(&err_type, &err_value, &err_tb);
 			}
@@ -104,7 +104,7 @@
 		if (entry->hash == hash && entry->key != dummy) {
 			if (!checked_error) {
 				checked_error = 1;
-				if (PyErr_Occurred()) {
+				if (_PyErr_OCCURRED()) {
 					restore_error = 1;
 					PyErr_Fetch(&err_type, &err_value,
 						    &err_tb);
@@ -720,7 +720,10 @@
 	if (so == NULL)
 		return NULL;
 
-	EMPTY_TO_MINSIZE(so);
+	/* tp_alloc has already zeroed the structure */
+	assert(so->table == NULL && so->fill == 0 && so->used == 0);
+	so->table = so->smalltable;
+	so->mask = PySet_MINSIZE - 1;
 	so->lookup = set_lookkey_string;
 	so->hash = -1;
 	so->weakreflist = NULL;



More information about the Python-checkins mailing list