Avoids calling ffi.dlopen(None) on Windows

ffi.dlopen(None) cannot work on Windows and it is a
known issue [1]. This patch avoids this call on Windows
hosts.

[1] https://bugs.python.org/issue23606

Change-Id: I44436146cdc402087f33f4b99054176134ec5b81
Closes-Bug: #1788025
This commit is contained in:
Claudiu Belu 2018-08-19 03:55:30 -07:00
parent b033057372
commit b1f50df3b1

View File

@ -108,13 +108,13 @@ int prctl (int __option, ...);
'''
ffi = cffi.FFI()
crt = ffi.dlopen(None)
ffi.cdef(CDEF)
if platform.system() == 'Linux':
# mock.patching crt.* directly seems to upset cffi. Use an
# indirection point here for easier testing.
crt = ffi.dlopen(None)
_prctl = crt.prctl
_capget = crt.capget
_capset = crt.capset