From: Jelte Jansen Date: Tue, 11 Oct 2011 09:58:29 +0000 (+0000) Subject: [master] python nested dlopen fix X-Git-Tag: perftcpdns_before_epoll~37^2~20^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f6445b024942629726daeb591f99af090aa43c28;p=thirdparty%2Fkea.git [master] python nested dlopen fix --- diff --git a/src/lib/python/isc/datasrc/__init__.py b/src/lib/python/isc/datasrc/__init__.py index 0b4ed989cf..7ebd91829a 100644 --- a/src/lib/python/isc/datasrc/__init__.py +++ b/src/lib/python/isc/datasrc/__init__.py @@ -1,6 +1,16 @@ import sys import os +# The datasource factory loader uses dlopen, as does python +# for its modules. Some dynamic linkers do not play nice if +# modules are not loaded with RTLD_GLOBAL, a symptom of which +# is that exceptions are not recognized by type. So to make +# sure this doesn't happen, we temporarily set RTLD_GLOBAL +# during the loading of the datasource wrappers. +import ctypes +flags = sys.getdlopenflags() +sys.setdlopenflags(flags | ctypes.RTLD_GLOBAL) + # this setup is a temporary workaround to deal with the problem of # having both 'normal' python modules and a wrapper module # Once all programs use the new interface, we should remove the @@ -16,6 +26,10 @@ if intree: from datasrc import * else: from isc.datasrc.datasrc import * + +# revert to the default dlopen flags +sys.setdlopenflags(flags) + from isc.datasrc.sqlite3_ds import * from isc.datasrc.master import *