Commits

Ronald Oussoren committed 696e384 Merge

merge

Comments (0)

Files changed (2)

pyobjc-core/Modules/objc/OC_PythonUnicode.m

 
 -(void)encodeWithCoder:(NSCoder*)coder
 {
+	int is_exact_unicode;
 	PyObjC_BEGIN_WITH_GIL
-		if (PyUnicode_CheckExact(value)) {
-			[super encodeWithCoder:coder];
+		is_exact_unicode = PyUnicode_CheckExact(value);
+	PyObjC_END_WITH_GIL
+
+	if (is_exact_unicode) {
+		[super encodeWithCoder:coder];
+	} else {
+		if ([coder allowsKeyedCoding]) {
+			[coder encodeInt32:2 forKey:@"pytype"];
 		} else {
-			if ([coder allowsKeyedCoding]) {
-				[coder encodeInt32:2 forKey:@"pytype"];
-			} else {
-				int v = 2;
-				[coder encodeValueOfObjCType:@encode(int) at:&v];
-			}
+			int v = 2;
+			[coder encodeValueOfObjCType:@encode(int) at:&v];
+		}
 
-			PyObjC_encodeWithCoder(value, coder);
-		}
-	PyObjC_END_WITH_GIL
+		PyObjC_encodeWithCoder(value, coder);
+	}
 }
 
 -(NSObject*)replacementObjectForArchiver:(NSArchiver*)archiver 
  */
 -(Class)classForArchiver
 {
+	Class result;
 	PyObjC_BEGIN_WITH_GIL
 		if (PyUnicode_CheckExact(value)) {
-			PyObjC_GIL_RETURN([NSString class]);
+			result = [NSString class];
 		} else {
-			PyObjC_GIL_RETURN([OC_PythonUnicode class]);
+			result = [OC_PythonUnicode class];
 		}
 	PyObjC_END_WITH_GIL
+
+	return result;
 }
 
 -(Class)classForKeyedArchiver

pyobjc-core/Modules/objc/unicode-object.m

 	if (res == NULL) {
 		PyErr_Clear();
 		PyObject *py_nsstr = meth_nsstring(o);
-		res = PyObject_GenericGetAttr(py_nsstr, attr_name);
+		res = PyObject_GetAttr(py_nsstr, attr_name);
 		Py_XDECREF(py_nsstr);
 	}
 	return res;