This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 464608c  fix python 3.8 ctypes dll load with windows (#19236)
464608c is described below

commit 464608ca1b5271ed6b8a1ef25fe6d900c4a1cc92
Author: Hu Shiwen <[email protected]>
AuthorDate: Thu Oct 1 08:00:09 2020 +0800

    fix python 3.8 ctypes dll load with windows (#19236)
---
 python/mxnet/base.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/mxnet/base.py b/python/mxnet/base.py
index 0b4bdf9..daa33b8 100644
--- a/python/mxnet/base.py
+++ b/python/mxnet/base.py
@@ -276,7 +276,12 @@ class MXCallbackList(ctypes.Structure):
 def _load_lib():
     """Load library by searching possible path."""
     lib_path = libinfo.find_lib_path()
-    lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
+    if sys.version_info >= (3, 8) and os.name == "nt":
+        # use LOAD_WITH_ALTERED_SEARCH_PATH, For simplicity, let's just fill 
the numbers.
+        # pylint: disable=E1123
+        lib = ctypes.CDLL(lib_path[0], winmode=0x00000008)
+    else:
+        lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
     # DMatrix functions
     lib.MXGetLastError.restype = ctypes.c_char_p
     return lib

Reply via email to