diff options
Diffstat (limited to 'plugins/pychrysalide/analysis')
| -rw-r--r-- | plugins/pychrysalide/analysis/types/array.c | 19 | 
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/pychrysalide/analysis/types/array.c b/plugins/pychrysalide/analysis/types/array.c index d021e16..6f70b02 100644 --- a/plugins/pychrysalide/analysis/types/array.c +++ b/plugins/pychrysalide/analysis/types/array.c @@ -281,7 +281,14 @@ static PyObject *py_array_type_get_dimension_expression(PyObject *self, void *cl      dim = g_array_type_get_dimension_expression(type); -    result = PyUnicode_FromString(dim); +    if (dim != NULL) +        result = PyUnicode_FromString(dim); + +    else +    { +        result = Py_None; +        Py_INCREF(result); +    }      return result; @@ -306,15 +313,19 @@ static int py_array_type_set_dimension_expression(PyObject *self, PyObject *valu  {      GArrayType *type;                       /* Version GLib du type        */ -    if (!PyUnicode_Check(value)) +    if (!PyUnicode_Check(value) && value != Py_None)      { -        PyErr_SetString(PyExc_TypeError, _("The attribute value must be a string.")); +        PyErr_SetString(PyExc_TypeError, _("The attribute value must be a string or None."));          return -1;      }      type = G_ARRAY_TYPE(pygobject_get(self)); -    g_array_type_set_dimension_expression(type, strdup(PyUnicode_DATA(value))); +    if (value == Py_None) +        g_array_type_set_empty_dimension(type); + +    else +        g_array_type_set_dimension_expression(type, strdup(PyUnicode_DATA(value)));      return 0;  | 
