--- /dev/null
+Fixed error messages for :c:func:`PySequence_Size`,
+:c:func:`PySequence_GetItem`, :c:func:`PySequence_SetItem` and
+:c:func:`PySequence_DelItem` called with a mapping and
+:c:func:`PyMapping_Size` called with a sequence.
return len;
}
+ if (s->ob_type->tp_as_mapping && s->ob_type->tp_as_mapping->mp_length) {
+ type_error("%.200s is not a sequence", s);
+ return -1;
+ }
type_error("object of type '%.200s' has no len()", s);
return -1;
}
return m->sq_item(s, i);
}
+ if (s->ob_type->tp_as_mapping && s->ob_type->tp_as_mapping->mp_subscript) {
+ return type_error("%.200s is not a sequence", s);
+ }
return type_error("'%.200s' object does not support indexing", s);
}
return m->sq_ass_item(s, i, o);
}
+ if (s->ob_type->tp_as_mapping && s->ob_type->tp_as_mapping->mp_ass_subscript) {
+ type_error("%.200s is not a sequence", s);
+ return -1;
+ }
type_error("'%.200s' object does not support item assignment", s);
return -1;
}
return m->sq_ass_item(s, i, (PyObject *)NULL);
}
+ if (s->ob_type->tp_as_mapping && s->ob_type->tp_as_mapping->mp_ass_subscript) {
+ type_error("%.200s is not a sequence", s);
+ return -1;
+ }
type_error("'%.200s' object doesn't support item deletion", s);
return -1;
}
return len;
}
+ if (o->ob_type->tp_as_sequence && o->ob_type->tp_as_sequence->sq_length) {
+ type_error("%.200s is not a mapping", o);
+ return -1;
+ }
+ /* PyMapping_Size() can be called from PyObject_Size(). */
type_error("object of type '%.200s' has no len()", o);
return -1;
}