Commits

Bob Ippolito committed a43937e

fixed the test (oops) and put in a temporary workaround

Comments (0)

Files changed (2)

Lib/objc/test/testoutputinitializer.m

     return self;
 }
 
--isInitialized
+-(BOOL)isInitialized
 {
     return _priv;
 }

Modules/objc/selector.m

 	PyObject* pyself = self->sel_self;
 	PyObjC_CallFunc execute = NULL;
 	PyObject* res;
+	PyObject* pyres;
 
 	if (pyself == NULL) {
 		int       argslen;
 
 
 	if (self->sel_self != NULL) {
-		res = execute((PyObject*)self, self->sel_self, args);
+		pyres = res = execute((PyObject*)self, self->sel_self, args);
+		if (pyres != NULL
+			&& PyTuple_Check(pyres)
+			&& PyTuple_GET_SIZE(pyres) > 1
+			&& PyTuple_GET_ITEM(pyres, 0) == pyself) {
+			pyres = pyself;
+		}
 
 #if defined(PYOBJC_NEW_INITIALIZER_PATTERN)
 		if (((PyObjCObject*)self->sel_self)->flags & PyObjCObject_kUNINITIALIZED) {
-			if (self->sel_self != res && !PyErr_Occurred()) {
+			if (self->sel_self != pyres && !PyErr_Occurred()) {
 				PyObjCObject_ClearObject(pyself);
 			}
 		}
 #else
 		if (self->sel_flags & PyObjCSelector_kINITIALIZER) {
-			if (self->sel_self != res && !PyErr_Occurred()) {
+			if (self->sel_self != pyres && !PyErr_Occurred()) {
 				PyObjCObject_ClearObject(self->sel_self);
 			}
 		}
 		if (!(PyObject_IsInstance(pyself, myClass)
 			|| (PyString_Check(pyself) && PyObjCClass_IsSubClass(self->sel_class, [NSString class])) 
 			|| (PyUnicode_Check(pyself) && PyObjCClass_IsSubClass(self->sel_class, [NSString class])) 
-		     )) {
+		)) {
 			Py_DECREF(arglist);
 			PyErr_Format(PyExc_TypeError,
 				"Expecting instance of %s as self, got one "
 		}
 		
 
-		res = execute((PyObject*)self, pyself, arglist);
+		pyres = res = execute((PyObject*)self, pyself, arglist);
+		if (pyres != NULL
+			&& PyTuple_Check(pyres)
+			&& PyTuple_GET_SIZE(pyres) > 1
+			&& PyTuple_GET_ITEM(pyres, 0) == pyself) {
+			pyres = pyself;
+		}
+
 #if !defined(PYOBJC_NEW_INITIALIZER_PATTERN)
 		if (self->sel_flags & PyObjCSelector_kINITIALIZER) {
-			if (pyself != res && !PyErr_Occurred()) {
+			if (pyself != pyres && !PyErr_Occurred()) {
 				PyObjCObject_ClearObject(pyself);
 			}
 		}
 		Py_DECREF(arglist);
 	}
 
-	if (res && PyObjCObject_Check(res)) {
+	if (pyres && PyObjCObject_Check(pyres)) {
 		if (self->sel_flags & PyObjCSelector_kRETURNS_UNINITIALIZED) {
-			((PyObjCObject*)res)->flags |= PyObjCObject_kUNINITIALIZED;
+			((PyObjCObject*)pyres)->flags |= PyObjCObject_kUNINITIALIZED;
 		}
 #if defined(PYOBJC_NEW_INITIALIZER_PATTERN)
-		else if (((PyObjCObject*)res)->flags & PyObjCObject_kUNINITIALIZED) {
-			((PyObjCObject*)res)->flags &= 
+		else if (((PyObjCObject*)pyres)->flags & PyObjCObject_kUNINITIALIZED) {
+			((PyObjCObject*)pyres)->flags &= 
 				~PyObjCObject_kUNINITIALIZED;
-			if (self->sel_self && self->sel_self != res && !PyErr_Occurred()) {
+			if (self->sel_self && self->sel_self != pyres && !PyErr_Occurred()) {
 				PyObjCObject_ClearObject(self->sel_self);
 			}
 		}
 #else
 		if (self->sel_flags & PyObjCSelector_kINITIALIZER) {
-			if (((PyObjCObject*)res)->flags & PyObjCObject_kUNINITIALIZED)
+			if (((PyObjCObject*)pyres)->flags & PyObjCObject_kUNINITIALIZED)
 			{
-				((PyObjCObject*)res)->flags &= 
+				((PyObjCObject*)pyres)->flags &= 
 					~PyObjCObject_kUNINITIALIZED;
 			}
 		}
 			 * increased retainCount, the retainCount is now one 
 			 * too high
 			 */
-			id obj = PyObjCObject_GetObject(res);
+			id obj = PyObjCObject_GetObject(pyres);
 			[obj release];
 		}
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.