From 5c47d551894e9833bb9cd8789a7349c0e8f8bf2d Mon Sep 17 00:00:00 2001
From: Bartosz Broda <bartosz.broda@gmail.com>
Date: Thu, 11 Oct 2012 22:08:01 +0200
Subject: [PATCH] setdlopenflags patch for windows

---
 iobber/chunker.py | 3 ++-
 iobber/corpio.py  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/iobber/chunker.py b/iobber/chunker.py
index d872499..3b705f3 100644
--- a/iobber/chunker.py
+++ b/iobber/chunker.py
@@ -17,7 +17,8 @@ __doc__ = """The actual chunker implementation."""
 # SWIG bug workaround: loading multiple SWIG modules brought unwrapped
 # swig::stop_iteration exceptions
 import ctypes, sys
-sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
+if 'setdlopenflags' in sys.__dict__:
+	sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
 
 import corpus2
 # TODO: get back to default dlopen policy?
diff --git a/iobber/corpio.py b/iobber/corpio.py
index ddf2737..5304651 100644
--- a/iobber/corpio.py
+++ b/iobber/corpio.py
@@ -15,7 +15,8 @@
 # SWIG bug workaround: loading multiple SWIG modules brought unwrapped
 # swig::stop_iteration exceptions
 import ctypes, sys
-sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
+if 'setdlopenflags' in sys.__dict__:
+	sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
 
 import corpus2, wccl
 # TODO: get back to default dlopen policy?
-- 
GitLab