Closed
Description
I was digging through the math.c source and found this:
>>> import pygame
pygame-ce 2.5.2.dev1 (SDL 2.30.6, Python 3.9.5)
>>> a = pygame.Vector2(30,40)
>>> del a.y
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Cannot delete the x attribute
I didn't try to delete the x attribute, I tried to delete the y attribute!
Implementation code (unchanged for 8 years):
static int
vector_set_component(pgVector *self, PyObject *value, int component)
{
if (value == NULL) {
PyErr_SetString(PyExc_TypeError, "Cannot delete the x attribute");
return -1;
}
if (component >= self->dim) {
PyErr_BadInternalCall();
return -1;
}
self->coords[component] = PyFloat_AsDouble(value);
if (PyErr_Occurred())
return -1;
return 0;
}