From 6671b7359fd042f576f5b944b67f73ced89fe5a6 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Tue, 8 Aug 2023 09:26:33 +0200 Subject: [PATCH] tests: fix "4 custom target depends extmodule" with Python 3.8+ on Windows Since CPython 3.8 .pyd files no longer look in PATH for loading libraries, but require the DLL directory to be explicitely added via os.add_dll_directory(). This resulted in those tests failing with 3.8+ on Windows. Add the DLL build directory with os.add_dll_directory() to fix them. This was never noticed in CI because it only uses Python 3.7 and the MSYS2 CPython still used the old behaviour until now. --- test cases/python/4 custom target depends extmodule/blaster.py | 3 +++ .../python3/4 custom target depends extmodule/blaster.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/test cases/python/4 custom target depends extmodule/blaster.py b/test cases/python/4 custom target depends extmodule/blaster.py index 61b11f922..65b6493df 100644 --- a/test cases/python/4 custom target depends extmodule/blaster.py +++ b/test cases/python/4 custom target depends extmodule/blaster.py @@ -10,6 +10,9 @@ filedir = Path(os.path.dirname(__file__)).resolve() if list(filedir.glob('ext/*tachyon*')): sys.path.insert(0, (filedir / 'ext').as_posix()) +if hasattr(os, 'add_dll_directory'): + os.add_dll_directory(filedir / 'ext' / 'lib') + import tachyon parser = argparse.ArgumentParser() diff --git a/test cases/python3/4 custom target depends extmodule/blaster.py b/test cases/python3/4 custom target depends extmodule/blaster.py index d2c93ad03..9cce64505 100644 --- a/test cases/python3/4 custom target depends extmodule/blaster.py +++ b/test cases/python3/4 custom target depends extmodule/blaster.py @@ -10,6 +10,9 @@ filedir = Path(os.path.dirname(__file__)).resolve() if list(filedir.glob('ext/*tachyon.*')): sys.path.insert(0, (filedir / 'ext').as_posix()) +if hasattr(os, 'add_dll_directory'): + os.add_dll_directory(filedir / 'ext' / 'lib') + import tachyon parser = argparse.ArgumentParser()