Commits

Ronald Oussoren committed 502d632 Merge

merge

  • Participants
  • Parent commits 91d1870, 7d0aff7

Comments (0)

Files changed (43)

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

 		[coder decodeValueOfObjCType:@encode(int) at:&ver];
 	}
 	if (ver == 1) {
+		/* Version 1: plain unicode string (not subclass).
+		 * emitted by some versions of PyObjC (< 2.4.1, < 2.5.1, <2.6)
+		 */
 		self = [super initWithCoder:coder];
 		return self;
 	} else if (ver == 2) {
 -(void)encodeWithCoder:(NSCoder*)coder
 {
 	if (PyUnicode_CheckExact(value)) {
-		if ([coder allowsKeyedCoding]) {
-			[coder encodeInt32:1 forKey:@"pytype"];
-		} else {
-			int v = 1;
-			[coder encodeValueOfObjCType:@encode(int) at:&v];
-		}
 		[super encodeWithCoder:coder];
 	} else {
 		if ([coder allowsKeyedCoding]) {
 	return self;
 }
 
+/* 
+ * Plain unicode objects (not subclasses) are archived as "real"
+ * NSString objects. This means you won't get the same object type back
+ * when reading them back, but does allow for better interop with code
+ * that uses a non-keyed archiver.
+ */
 -(Class)classForArchiver
 {
-	return [OC_PythonUnicode class];
+	if (PyUnicode_CheckExact(value)) {
+		return [NSString class];
+	} else {
+		return [OC_PythonUnicode class];
+	}
 }
 
 -(Class)classForKeyedArchiver
 {
-	return [OC_PythonUnicode class];
+	if (PyUnicode_CheckExact(value)) {
+		return [NSString class];
+	} else {
+		return [OC_PythonUnicode class];
+	}
 }
 
 -(Class)classForCoder
 {
-	return [OC_PythonUnicode class];
+	if (PyUnicode_CheckExact(value)) {
+		return [NSString class];
+	} else {
+		return [OC_PythonUnicode class];
+	}
 }
 
 -(Class)classForPortCoder
 {
-	return [OC_PythonUnicode class];
+	if (PyUnicode_CheckExact(value)) {
+		return [NSString class];
+	} else {
+		return [OC_PythonUnicode class];
+	}
 }
 
 /* Ensure that we can be unarchived as a generic string by pure ObjC

File pyobjc-core/Modules/objc/pyobjc.h

File contents unchanged.

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

 		signature = repl_sig;
 	}
 
+	if (signature == NULL) {
+		PyErr_SetString(PyObjCExc_Error, "Selector with NULL or too long signature");
+		return NULL;
+	}
+
 	result = PyObject_New(PyObjCNativeSelector, &PyObjCNativeSelector_Type);
 	if (result == NULL) return NULL;
 

File pyobjc-core/NEWS.txt

 
    This is version currently in development and has not been released yet
 
-- ...
-
-
+Version 2.5.1
+-------------
+
+- PyObjC could crash when calling a method that is dynamicly generated
+  (that is, the selector is not present in the class according to the 
+  Objective-C runtime but the instance responds to it anyway). 
+
+  The cases that used to crash now raise :exc:`objc.error` instead.
+
+  .. note:: 
+     It is highly unlikely that real code would run into this, found
+     while working on PyObjC 3.x.
+
+- When writing a python unicode object to an NSArchiver or NSKeyedArchiver
+  the object is now stored exactly the same as a normal NSString, and will
+  be read back as such.
+
+  This increases interoperability with code that expects to read back a
+  non-keyed archive in a different proces. An example of this is the use
+  of Growl.
+
+  Instances of subclasses of unicode are not affected by this change, and
+  can only be read back by other PyObjC programs.
 
 Version 2.5
 -----------

File pyobjc-framework-Accounts/setup.py

File contents unchanged.

File pyobjc-framework-AddressBook/setup.py

File contents unchanged.

File pyobjc-framework-AppleScriptKit/setup.py

File contents unchanged.

File pyobjc-framework-AppleScriptObjC/setup.py

File contents unchanged.

File pyobjc-framework-Automator/setup.py

File contents unchanged.

File pyobjc-framework-CFNetwork/setup.py

File contents unchanged.

File pyobjc-framework-CalendarStore/setup.py

File contents unchanged.

File pyobjc-framework-Cocoa/setup.py

File contents unchanged.

File pyobjc-framework-Collaboration/setup.py

File contents unchanged.

File pyobjc-framework-CoreData/setup.py

File contents unchanged.

File pyobjc-framework-CoreLocation/setup.py

File contents unchanged.

File pyobjc-framework-CoreText/setup.py

File contents unchanged.

File pyobjc-framework-DictionaryServices/setup.py

File contents unchanged.

File pyobjc-framework-EventKit/setup.py

File contents unchanged.

File pyobjc-framework-ExceptionHandling/setup.py

File contents unchanged.

File pyobjc-framework-FSEvents/setup.py

File contents unchanged.

File pyobjc-framework-InputMethodKit/setup.py

File contents unchanged.

File pyobjc-framework-InstallerPlugins/setup.py

File contents unchanged.

File pyobjc-framework-InstantMessage/setup.py

File contents unchanged.

File pyobjc-framework-InterfaceBuilderKit/setup.py

File contents unchanged.

File pyobjc-framework-LatentSemanticMapping/setup.py

File contents unchanged.

File pyobjc-framework-LaunchServices/setup.py

File contents unchanged.

File pyobjc-framework-Message/setup.py

File contents unchanged.

File pyobjc-framework-OpenDirectory/setup.py

File contents unchanged.

File pyobjc-framework-PreferencePanes/setup.py

File contents unchanged.

File pyobjc-framework-PubSub/setup.py

File contents unchanged.

File pyobjc-framework-QTKit/setup.py

File contents unchanged.

File pyobjc-framework-Quartz/setup.py

File contents unchanged.

File pyobjc-framework-ScreenSaver/setup.py

File contents unchanged.

File pyobjc-framework-ScriptingBridge/setup.py

File contents unchanged.

File pyobjc-framework-SearchKit/setup.py

File contents unchanged.

File pyobjc-framework-ServerNotification/setup.py

File contents unchanged.

File pyobjc-framework-ServiceManagement/setup.py

File contents unchanged.

File pyobjc-framework-Social/setup.py

File contents unchanged.

File pyobjc-framework-SyncServices/setup.py

File contents unchanged.

File pyobjc-framework-SystemConfiguration/setup.py

File contents unchanged.

File pyobjc-framework-WebKit/setup.py

File contents unchanged.

File pyobjc-framework-XgridFoundation/setup.py

File contents unchanged.

File pyobjc/setup.py

File contents unchanged.