[Python-Dev] Re: are CObjects inherently unsafe?

Fredrik Lundh fredrik at pythonware.com
Mon Dec 8 05:59:18 EST 2003

Greg Ewing wrote:

> Another API suggestion: a function such as
>   void* PyCObject_AsVoidPtrWithDesc(PyObject* self, void *expected_desc)
> which checks the desc and raises an exception if it doesn't
> match the expected value.

which should probably be

    void* PyCObject_AsVoidPtrWithStringDesc(PyObject* self, const char *expected_desc)
        /* uses desc && !strcmp(desc, expected_desc), and can still crash... */

    void* PyCObject_AsVoidPtrWithPtrDesc(PyObject* self, void *expected_desc)
        /* uses desc == expected_desc */


More information about the Python-Dev mailing list