[Python-Dev] future-proofing vector tables for python APIs: binary-module interoperability

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sun Jan 25 16:37:47 CET 2009


> decoupling posixmodule.c from pythonNN.dll leaves the possibility to
> make python independent of msvcrt versioning.
>
> it would need to be a custom-compiled .pyd module, due to the early dependency.
>
> i'll see if this is possible.

i'd added PyExc_OSError, for example, as data exported from dlls.  i'm
finding that this causes.... problems :)

so when posixmodule.c is a module (nt.pyd), doing this works:

PyAPI_FUNC(PyObject *)
PyErr_GetPyExc_OSError(void)
{
    return (PyObject*)PyExc_OSError;
}

and thus

    oserr = PyErr_GetPyExc_OSError();

    Py_INCREF(oserr);
    PyModule_AddObject(m, "error", oserr)

but doing _direct_ access to PyExc_OSError fails miserably.

i'll try to track down why (am adding __cdecl to PyAPI_DATA to see if
that helps).

l.


More information about the Python-Dev mailing list