[PyObjC-svn] r2216 - in trunk/pyobjc/pyobjc-core: Lib/objc/test Modules/objc

[email protected] Thu, 14 May 2009 03:34:37 -0500
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Thu May 14 03:34:37 2009
New Revision: 2216

Log:
* Small patches to enable building on 10.4.

This is not perfect, I get a number of failures in a full test run (but 
annoyingly the same tests pass when I run them seperately).



Modified:
   trunk/pyobjc/pyobjc-core/Lib/objc/test/test_leaks.py
   trunk/pyobjc/pyobjc-core/Modules/objc/objc_util.m
   trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m
   trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h
   trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-compat.h

Modified: trunk/pyobjc/pyobjc-core/Lib/objc/test/test_leaks.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/Lib/objc/test/test_leaks.py	(original)
+++ trunk/pyobjc/pyobjc-core/Lib/objc/test/test_leaks.py	Thu May 14 03:34:37 2009
@@ -2,7 +2,7 @@
 Check if we manage retainCounts correctly.
 """
 from PyObjCTools.TestSupport import *
-import objc
+import objc, gc
 from objc.test.fnd import *
 
 LeaksDel = 0
@@ -102,6 +102,7 @@
         self.assertEquals(LeaksDel, 0)
         del o
         del pool
+        gc.collect()
         self.assertEquals(LeaksDel, 1)
 
 

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/objc_util.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/objc_util.m	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/objc_util.m	Thu May 14 03:34:37 2009
@@ -319,10 +319,7 @@
 	if (state) {
 		PyGILState_Release(*state);
 	}
-	@throw exc;
-#if 0
 	[exc raise];
-#endif
 }
 
 
@@ -764,7 +761,7 @@
 	/* A more complex array */
 
 #if PY_VERSION_HEX >= 0x02060000
-	if (PyObject_CheckBuffer(obj)) {
+	if (PyObject_CheckBuffer(pythonList)) {
 		/* An object that implements the new-style buffer interface.
 		 * Use the buffer interface description to check if the buffer
 		 * type is compatible with what we expect.

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/parsexml.m	Thu May 14 03:34:37 2009
@@ -756,6 +756,12 @@
 	if (tollfree != NULL) {
 		Class cls = objc_lookUpClass(tollfree);
 		if (cls == NULL) {
+			if (tollfree[0] == '_' && tollfree[1] == '_') {
+				cls = objc_lookUpClass(tollfree+2);
+			}
+		}
+
+		if (cls == NULL) {
 			retval = 0;
 			goto end;
 		}

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-api.h	Thu May 14 03:34:37 2009
@@ -19,6 +19,41 @@
 #include "Python.h"
 #include <objc/objc.h>
 
+#import <Foundation/NSObjCRuntime.h>
+
+#ifndef CGFLOAT_DEFINED
+
+#ifdef __LP64__
+# error "Huh? 64-bit but no CFFloat available???"
+#endif
+
+typedef float CGFloat;
+#define CGFLOAT_MIN FLT_MIN
+#define CGFLOAT_MAX FLT_MAX
+#define CGFLOAT_IS_DOUBLE 0
+#define CGFLOAT_DEFINED
+
+#endif /* CGFLOAT_DEFINED */
+
+
+#ifndef NSINTEGER_DEFINED
+
+#ifdef __LP64__
+# error "Huh? 64-bit but no NSINTEGER available???"
+#endif
+
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+
+#define NSIntegerMax    LONG_MAX
+#define NSIntegerMin    LONG_MIN
+#define NSUIntegerMax   ULONG_MAX
+
+#define NSINTEGER_DEFINED
+
+#endif
+
+
 #ifndef PyObjC_COMPAT_H
 #if (PY_VERSION_HEX < 0x02050000)
 typedef int Py_ssize_t;

Modified: trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-compat.h
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-compat.h	(original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/pyobjc-compat.h	Thu May 14 03:34:37 2009
@@ -1,6 +1,42 @@
 #ifndef PyObjC_COMPAT_H
 #define PyObjC_COMPAT_H
 
+#import <Foundation/NSObjCRuntime.h>
+
+
+#ifndef CGFLOAT_DEFINED
+
+#ifdef __LP64__
+# error "Huh? 64-bit but no CFFloat available???"
+#endif
+
+typedef float CGFloat;
+#define CGFLOAT_MIN FLT_MIN
+#define CGFLOAT_MAX FLT_MAX
+#define CGFLOAT_IS_DOUBLE 0
+#define CGFLOAT_DEFINED
+
+#endif /* CGFLOAT_DEFINED */
+
+
+#ifndef NSINTEGER_DEFINED
+
+#ifdef __LP64__
+# error "Huh? 64-bit but no NSINTEGER available???"
+#endif
+
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+
+#define NSIntegerMax    LONG_MAX
+#define NSIntegerMin    LONG_MIN
+#define NSUIntegerMax   ULONG_MAX
+
+#define NSINTEGER_DEFINED
+
+#endif
+
+
 /* 
  * Compatibilty definitions 
  */
@@ -67,29 +103,4 @@
 #endif
 
 
-/* NSInteger and friends are available on Leopard and later, define them here
- * for compatibility with earlier versions.
- *
- * Note that the guard definition is the same as used by Leopard itself.
- */
-#import <Foundation/NSObjCRuntime.h>
-
-#ifndef NSINTEGER_DEFINED
-
-#ifdef __LP64__
-# error "Huh? 64-bit but no NSINTEGER available???"
-#endif
-
-typedef int NSInteger;
-typedef unsigned int NSUInteger;
-
-#define NSIntegerMax    LONG_MAX
-#define NSIntegerMin    LONG_MIN
-#define NSUIntegerMax   ULONG_MAX
-
-#define NSINTEGER_DEFINED
-
-#endif
-
-
 #endif /* PyObjC_COMPAT_H */

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com