[Python-apps-team] Bug#607112: fixed upstream

Jakub Wilk jwilk at debian.org
Thu Dec 30 17:09:20 UTC 2010


* Stefan Behnel <stefan_ml at behnel.de>, 2010-12-30, 08:37:
>Works for me in 0.14.

Hmm, I just tested 0.14 and I get the very same warning.

The code in question (generated by Cython 0.14) is:

| static struct __pyx_vtabstruct_4eggs_Eggs *__pyx_vtabptr_4eggs_Eggs;
|
| [...]
| 
| static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) {
|     [...]
| #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
|     *(void **)vtabptr = PyCapsule_GetPointer(ob, 0);
| #else
|     *(void **)vtabptr = PyCObject_AsVoidPtr(ob);
| #endif
|     [...]
| }
| 
| [...]
| 
|   if (__Pyx_GetVtable(__pyx_ptype_4eggs_Eggs->tp_dict, &__pyx_vtabptr_4eggs_Eggs) < 0) [...]

So a (struct __pyx_vtabstruct_4eggs_Eggs **) is casted to (void *), then 
casted to (void **), and then dereferenced. This indeed violates C 
aliasing rules.

-- 
Jakub Wilk





More information about the Python-apps-team mailing list