Commits

Ronald Oussoren  committed 2b7973f

Slightly better error checking

Explicitly check the results of a Python API call instead
of relying on the argument checking of the next call.

  • Participants
  • Parent commits 1080271

Comments (0)

Files changed (1)

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

 
 	} else {
 		PyObject* v = PyInt_FromLong(typeId);
-		int r = PyDict_SetItemString(PyObjC_TypeStr2CFTypeID, encoding, v);
+		int r;
+
+		if (v == NULL) {
+			return NULL;
+		}
+
+		r = PyDict_SetItemString(PyObjC_TypeStr2CFTypeID, encoding, v);
 		Py_DECREF(v);
 		if (r == -1) {
 			return NULL;