Commits

Virgil Dupras committed 39b502b

In list/dict p2o conversion, convert objc's "nil" to [NSNull null] so that it can be inserted into a NSArray or NSDictionary.

Comments (0)

Files changed (1)

     NSMutableArray *result = [NSMutableArray array];
     while ( (item = PyIter_Next(iterator)) ) {
         OBJP_ERRCHECK(item);
-        [result addObject:ObjP_obj_p2o(item)];
+        NSObject *value = ObjP_obj_p2o(item);
+        if (value == nil) {
+            value = [NSNull null];
+        }
+        [result addObject:value];
         Py_DECREF(item);
     }
     Py_DECREF(iterator);
         OBJP_ERRCHECK(pValue);
         NSString *key = ObjP_str_p2o(pKey);
         NSObject *value = ObjP_obj_p2o(pValue);
+        if (value == nil) {
+            value = [NSNull null];
+        }
         [result setObject:value forKey:key];
     }
     OBJP_UNLOCKGIL;