Commits

Ronald Oussoren  committed 019be6e

Don't bother to set boolean values in the python datastructures that
the xml parser creates when those values are the default. This should
reduce memory uage.

Thanks to Virgil Dupras for the tip.

  • Participants
  • Parent commits 91cd852
  • Branches pyobjc-ancient

Comments (0)

Files changed (1)

File pyobjc-core/Modules/objc/parsexml.m

 	for (; *bool_attrs != NULL; bool_attrs++) {
 		if (attribute_bool(node, *bool_attrs, NULL, NO)) {
 			r = PyDict_SetItemString(result, *bool_attrs, Py_True);
+			if (r == -1) {
+				Py_DECREF(result);
+				return NULL;
+			}
+#if 0
+		/* Don't store default value */
 		} else {
 			r = PyDict_SetItemString(result, *bool_attrs, Py_False);
-		}
-		if (r == -1) {
-			Py_DECREF(result);
-			return NULL;
+			if (r == -1) {
+				Py_DECREF(result);
+				return NULL;
+			}
+#endif
 		}
 	}
 
 	if (attribute_bool(node, "null_accepted", NULL, YES)) {
+#if 0
+		/* Don't store default value */
 		r = PyDict_SetItemString(result, "null_accepted", Py_True);
+#else
+		r = 0;
+#endif
 	} else {
 		r = PyDict_SetItemString(result, "null_accepted", Py_False);
 	}