Skip to content

Commit a2d70e0

Browse files
committed
feat: Disable loading Python DLLs from PATH by default on Windows
Users can enable the legacy behavior by setting env var `OIIO_PYTHON_LOAD_DLLS_FROM_PATH=1`. This commit also changes the environment variable name from `OIIO_LOAD_DLLS_FROM_PATH` to `OIIO_PYTHON_LOAD_DLLS_FROM_PATH` to match the convention used by OCIO. Signed-off-by: Zach Lewis <[email protected]>
1 parent 85ece69 commit a2d70e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/python/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
# This works around the python 3.8 change to stop loading DLLs from PATH on Windows.
88
# We reproduce the old behaviour by manually tokenizing PATH, checking that the directories exist and are not ".",
99
# then add them to the DLL load path.
10-
# This behviour can be disabled by setting the environment variable "OIIO_LOAD_DLLS_FROM_PATH" to "0"
11-
if sys.version_info >= (3, 8) and platform.system() == "Windows" and os.getenv("OIIO_LOAD_DLLS_FROM_PATH", "1") == "1":
10+
# This behviour can be enabled by setting the environment variable "OIIO_PYTHON_LOAD_DLLS_FROM_PATH" to "1"
11+
if sys.version_info >= (3, 8) and platform.system() == "Windows" and os.getenv("OIIO_PYTHON_LOAD_DLLS_FROM_PATH", "0") == "1":
1212
for path in os.getenv("PATH", "").split(os.pathsep):
1313
if os.path.exists(path) and path != ".":
1414
os.add_dll_directory(path)

0 commit comments

Comments
 (0)