summaryrefslogtreecommitdiff
path: root/cffi/vengine_cpy.py
diff options
context:
space:
mode:
authorRomain Guillebert <romain.py@gmail.com>2014-12-17 18:04:31 +0100
committerRomain Guillebert <romain.py@gmail.com>2014-12-17 18:04:31 +0100
commitf21275f32a144ebad5af796139dff3ff5ce5dda3 (patch)
treec7c6736ed19485f13d3c79c4a14311979ed4f728 /cffi/vengine_cpy.py
parent64d9193c497fadd9c2f36ecfe6e17ef51339bba6 (diff)
parentef434374ec32ab2cf54d4caab84f98029391bbaf (diff)
downloadcffi-f21275f32a144ebad5af796139dff3ff5ce5dda3.tar.gz
Merge heads
Diffstat (limited to 'cffi/vengine_cpy.py')
-rw-r--r--cffi/vengine_cpy.py9
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