[PyObjC-svn] r2006 - trunk/pyobjc/pyobjc-core/Modules/objc

[email protected]
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Tue May 27 04:58:58 2008
New Revision: 2006

Log:
- Partial workaround for metadata lameness in de bridgesupport files
  shipped with Leopard
- A previous checkin broke NSCoding support, fix that again.


Modified:
   trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonArray.m
   trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonDictionary.m
   trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonSet.m
   trunk/pyobjc/pyobjc-core/Modules/objc/objc_support.m

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonArray.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonArray.m	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonArray.m	Tue May 27 04:58:58 2008
@@ -304,7 +304,7 @@
 	 * Instances of 'list' and 'tuple' are encoded directly,
 	 * for other sequences use the generic pickle support code.
 	 */
-	if (1 && PyTuple_CheckExact(value)) {
+	if (PyTuple_CheckExact(value)) {
 		if ([coder allowsKeyedCoding]) {
 			[coder encodeInt32:1 forKey:@"pytype"];
 		} else {
@@ -312,7 +312,7 @@
 			[coder encodeValueOfObjCType:@encode(int) at:&v];
 		}
 		[super encodeWithCoder:coder];
-	} else if (1 && PyList_CheckExact(value)) {
+	} else if (PyList_CheckExact(value)) {
 		if ([coder allowsKeyedCoding]) {
 			[coder encodeInt32:2 forKey:@"pytype"];
 		} else {
@@ -336,6 +336,11 @@
  * A basic implementation of -initWithObjects:count:. This method is needed
  * to support NSCoding for Python sequences.
  */
+-(Class)classForCoder
+{
+	return [OC_PythonArray class];
+}
+
 -(id)initWithObjects:(NSObject**)objects count:(NSUInteger)count
 {
 	NSUInteger i;

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonDictionary.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonDictionary.m	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonDictionary.m	Tue May 27 04:58:58 2008
@@ -500,6 +500,12 @@
 	return nil;
 }
 
+-(Class)classForCoder
+{
+	return [OC_PythonDictionary class];
+}
+
+
 - (void)encodeWithCoder:(NSCoder*)coder
 {
 	if (1 && PyDict_CheckExact(value)) {

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonSet.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonSet.m	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonSet.m	Tue May 27 04:58:58 2008
@@ -107,6 +107,12 @@
 
 /* NSCoding support */
 
+-(Class)classForCoder
+{
+	return [OC_PythonSet class];
+}
+
+
 - (void)encodeWithCoder:(NSCoder*)coder
 {
 	PyObjC_encodeWithCoder(value, coder);

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/objc_support.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/objc_support.m	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/objc_support.m	Tue May 27 04:58:58 2008
@@ -728,6 +728,9 @@
 	case _C_BFLD:
 		return 1;
 
+	case _C_UNDEF:
+		return __alignof__(void*);
+
 	default:
 		PyErr_Format(PyObjCExc_InternalError, 
 			"PyObjCRT_AlignOfType: Unhandled type '%#x' %s", *type, type);
@@ -884,6 +887,9 @@
 		}
 		break;
 
+	case _C_UNDEF:
+		return sizeof(void*);
+
 	default:
 		PyErr_Format(PyObjCExc_InternalError, 
 			"PyObjCRT_SizeOfType: Unhandled type '%#x', %s", *type, type);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.