Skip to content

Commit 4fe9060

Browse files
committed
Some rewording after feedback
We shouldn't advertise PYTHONLEGACYWINDOWSDLLLOADING that much, so don't document it and note in the NEWS that we will remove it after some time. Also note that the old behaviour is a security issue.
1 parent 9941fc1 commit 4fe9060

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

web/docs/python.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ if os.name == "nt" and sysconfig.get_platform().startswith("mingw"):
2222
print("cpython-mingw detected!")
2323
```
2424

25-
Unlike many other Windows packages in MSYS2, Python will not look for DLL dependencies in PATH by default, but requires directories to be explicitly added via `os.add_dll_directory()` at runtime. You can disable this behavior, and make it look in PATH, by setting the `PYTHONLEGACYWINDOWSDLLLOADING` environment variable to `1`.
26-
2725
### Known issues
2826

2927
* C extensions are not compatible with the official CPython, which means pip can't use binary wheels from PyPI and packages have to be build when installing them.

web/news.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,28 @@ This page lists important changes or issues affecting MSYS2 users. We also post
99

1010
Starting with CPython 3.8, upstream CPython changed their DLL lookup behavior to
1111
a safer default when loading extension modules, which meant no longer looking in
12-
PATH, but requiring code to explicitly add directories containing dependencies
13-
via
12+
PATH and the current working directory as a fallback, but requiring code to
13+
explicitly add directories containing dependencies via
1414
[`os.add_dll_directory()`](https://docs.python.org/3/library/os.html#os.add_dll_directory).
1515

1616
Because many packages weren't ported yet back then, and this behavior interfered
17-
with our MinGW port build process we decided to revert this change and keep the
18-
old behavior. This had the downside that `os.add_dll_directory()` did not have
19-
any effect with our Python port and required different code paths for the
20-
official CPython and our one.
17+
with our MinGW port build process we reverted this change and kept the old
18+
behavior. This had the downsides of being less secure and
19+
`os.add_dll_directory()` not working.
2120

22-
We have now switched the default to what the official CPython build does, but
23-
added a new `PYTHONLEGACYWINDOWSDLLLOADING` environment variable which you can
24-
set to `1` to get back the legacy behavior if needed.
21+
We have now finally managed to fix this in our port, so that DLL loading works
22+
the same as with the official CPython distribution.
2523

2624
If this change is causing problems for you:
2725

28-
* Make sure to use `os.add_dll_directory()`, as recommended by upstream, see
29-
https://docs.python.org/3/library/os.html#os.add_dll_directory for details
30-
* If that doesn't work you can use `export PYTHONLEGACYWINDOWSDLLLOADING=1` to
31-
revert to the old behavior. Please let us know why you need it, so we can
32-
hopefully adjust our build to handle more use cases by default.
26+
* Make sure to use `os.add_dll_directory()` where needed, as recommended by
27+
upstream, see https://docs.python.org/3/library/os.html#os.add_dll_directory
28+
for details
29+
* To ease the transition we've temporarily added a
30+
`PYTHONLEGACYWINDOWSDLLLOADING` environment variable, which you can set to `1`
31+
to get back the old behavior. We will remove this workaround after some time,
32+
so please let us know if there are any problems that can't be solved without
33+
it.
3334

3435
### 2023-04-01 - LLVM 16
3536

0 commit comments

Comments
 (0)