PyObject *dictkey_todecref;
#define DICTKEY_GET(err) \
if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
- return err;
+ return err; \
+ if (*key == NUL) \
+ { \
+ PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
+ return err; \
+ }
#define DICTKEY_UNREF \
Py_XDECREF(dictkey_todecref);
static PyTypeObject DictionaryType;
-#define DICTKEY_GET_NOTEMPTY(err) \
- DICTKEY_GET(err) \
- if (*key == NUL) \
- { \
- PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
- return err; \
- }
-
typedef struct
{
PyObject_HEAD
dictitem_T *di;
DICTKEY_DECL
- DICTKEY_GET_NOTEMPTY(NULL)
+ DICTKEY_GET(NULL)
di = dict_find(self->dict, key, -1);
return -1;
}
- DICTKEY_GET_NOTEMPTY(-1)
+ DICTKEY_GET(-1)
di = dict_find(dict, key, -1);
if (self->Check(self->from))
return NULL;
- DICTKEY_GET_NOTEMPTY(NULL)
+ DICTKEY_GET(NULL)
flags = get_option_value_strict(key, &numval, &stringval,
self->opt_type, self->from);
if (self->Check(self->from))
return -1;
- DICTKEY_GET_NOTEMPTY(-1)
+ DICTKEY_GET(-1)
flags = get_option_value_strict(key, NULL, NULL,
self->opt_type, self->from);
if (valObject == NULL)
return -1;
- DICTKEY_GET_NOTEMPTY(-1)
+ DICTKEY_GET(-1)
di = dictitem_alloc(key);
return -1;
}
- DICTKEY_GET_NOTEMPTY(-1)
+ DICTKEY_GET(-1)
valObject = PyTuple_GetItem(litem, 1);
if (valObject == NULL)