python: Fix import.

* lang/python/helpers.c (pygpgme_exception_init): Make module import
relative.

Signed-off-by: Justus Winter <justus@gnupg.org>
This commit is contained in:
Justus Winter 2016-05-19 10:49:43 +02:00
parent 375523ead3
commit 07f71cd177

View File

@ -29,7 +29,10 @@ static PyObject *GPGMEError = NULL;
void pygpgme_exception_init(void) { void pygpgme_exception_init(void) {
if (GPGMEError == NULL) { if (GPGMEError == NULL) {
PyObject *errors; PyObject *errors;
errors = PyImport_ImportModule("errors"); PyObject *from_list = PyList_New(0);
errors = PyImport_ImportModuleLevel("errors", PyEval_GetGlobals(),
PyEval_GetLocals(), from_list, 1);
Py_XDECREF(from_list);
if (errors) { if (errors) {
GPGMEError=PyDict_GetItemString(PyModule_GetDict(errors), "GPGMEError"); GPGMEError=PyDict_GetItemString(PyModule_GetDict(errors), "GPGMEError");
Py_XINCREF(GPGMEError); Py_XINCREF(GPGMEError);