diff options
author | Romain Guillebert <romain.py@gmail.com> | 2014-12-17 18:04:31 +0100 |
---|---|---|
committer | Romain Guillebert <romain.py@gmail.com> | 2014-12-17 18:04:31 +0100 |
commit | f21275f32a144ebad5af796139dff3ff5ce5dda3 (patch) | |
tree | c7c6736ed19485f13d3c79c4a14311979ed4f728 /cffi/vengine_cpy.py | |
parent | 64d9193c497fadd9c2f36ecfe6e17ef51339bba6 (diff) | |
parent | ef434374ec32ab2cf54d4caab84f98029391bbaf (diff) | |
download | cffi-f21275f32a144ebad5af796139dff3ff5ce5dda3.tar.gz |
Merge heads
Diffstat (limited to 'cffi/vengine_cpy.py')
-rw-r--r-- | cffi/vengine_cpy.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cffi/vengine_cpy.py b/cffi/vengine_cpy.py index 8a2aa18..c9af57f 100644 --- a/cffi/vengine_cpy.py +++ b/cffi/vengine_cpy.py @@ -138,15 +138,22 @@ class VCPythonEngine(object): prnt() prnt('#endif') - def load_library(self): + def load_library(self, flags=None): # XXX review all usages of 'self' here! # import it as a new extension module + if hasattr(sys, "getdlopenflags"): + previous_flags = sys.getdlopenflags() try: + if hasattr(sys, "setdlopenflags") and flags is not None: + sys.setdlopenflags(flags) module = imp.load_dynamic(self.verifier.get_module_name(), self.verifier.modulefilename) except ImportError as e: error = "importing %r: %s" % (self.verifier.modulefilename, e) raise ffiplatform.VerificationError(error) + finally: + if hasattr(sys, "setdlopenflags"): + sys.setdlopenflags(previous_flags) # # call loading_cpy_struct() to get the struct layout inferred by # the C compiler |