Commits

Ronald Oussoren  committed fa2a0ab

Fix typo in depythonify_c_value, missing 'else' in what was intended as an
cascaded if-statement.

Also allow the user to specify the empty string for 'no selector'.

  • Participants
  • Parent commits 074671f

Comments (0)

Files changed (1)

File pyobjc/Modules/objc/objc_support.m

 	case _C_SEL:
 		if (argument == Py_None) {
 			*(SEL*)datum = NULL;
-		} if (ObjCSelector_Check (argument)) {
+		} else if (ObjCSelector_Check (argument)) {
 			*(SEL *) datum = ObjCSelector_Selector(argument); 
         	} else if (PyString_Check(argument)) {
 			char *selname = PyString_AsString (argument);
-			SEL sel = SELUID (selname);
+			SEL sel;
 
-			if (sel)  {
-				*(SEL*) datum = sel;
+			if (*selname == '\0') {
+				*(SEL*)datum = NULL;
 			} else {
-				ObjCErr_Set(PyExc_ValueError,
-					"depythonifying 'SEL', cannot "
-					"register string with runtime");
-				return -1;
+				sel = SELUID (selname);
+
+				if (sel)  {
+					*(SEL*) datum = sel;
+				} else {
+					ObjCErr_Set(PyExc_ValueError,
+						"depythonifying 'SEL', cannot "
+						"register string with runtime");
+					return -1;
+				}
 			}
 		} else {
 			ObjCErr_Set(PyExc_ValueError,