[PyObjC-svn] r2022 - trunk/pyobjc/pyobjc-core/Modules/objc
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Thu Oct 23 06:23:53 2008
New Revision: 2022
Log:
Explicitly convert Python's True and False using [NSNumber numberWithBool:],
needed because some lower-level API's seem to test for boolean singletons
(such as kCFBooleanTrue) instead of using the value inside and NSNumber.
Modified:
trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m
Modified: trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m
==============================================================================
--- trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m (original)
+++ trunk/pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m Thu Oct 23 06:23:53 2008
@@ -111,7 +111,12 @@
r = -1;
}
} else if (PyBool_Check(argument)) {
- rval = [OC_PythonNumber newWithPythonObject:argument];
+ if (argument == Py_True) {
+ rval = [NSNumber numberWithBool:1];
+ } else {
+ rval = [NSNumber numberWithBool:0];
+ }
+ //rval = [OC_PythonNumber newWithPythonObject:argument];
PyObjC_RegisterObjCProxy(argument, rval);
r = 0;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/