Commits

Virgil Dupras committed 7f94c6d

o2p methods returning str, list and dict now return nil when converting None.

  • Participants
  • Parent commits e1dc01d

Comments (0)

Files changed (1)

File objp/data/ObjP.m

 
 NSString* ObjP_str_p2o(PyObject *pStr)
 {
+    if (pStr == Py_None) {
+        return nil;
+    }
     OBJP_LOCKGIL;
     PyObject *pBytes = PyUnicode_AsUTF8String(pStr);
     OBJP_ERRCHECK(pBytes);
 
 NSArray* ObjP_list_p2o(PyObject *pList)
 {
+    if (pList == Py_None) {
+        return nil;
+    }
     OBJP_LOCKGIL;
     PyObject *iterator = PyObject_GetIter(pList);
     OBJP_ERRCHECK(iterator);
 
 NSDictionary* ObjP_dict_p2o(PyObject *pDict)
 {
+    if (pDict == Py_None) {
+        return nil;
+    }
     PyObject *pKey, *pValue;
     Py_ssize_t pos = 0;
     OBJP_LOCKGIL;