diff options
| author | Simon Sawicki <accounts@grub4k.xyz> | 2023-01-26 19:39:33 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-26 19:40:57 +0100 |
| commit | 9eae81724d80b3b2901377f63ee560f9c56ffd63 (patch) | |
| tree | 330b406fcff729c96190facccd7978f753291d54 | |
| parent | 719a14badcd226732c9c1172f8183e5f42e54241 (diff) | |
[4.2.x] Fixed #34294 -- Protected django.core.files.locks against argtypes redefinition on Windows.
Backport of 7eb5391b71f473dd13abdaaef143a5509160487f from main
| -rw-r--r-- | django/core/files/locks.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/core/files/locks.py b/django/core/files/locks.py index 5752b08a69..c0f471f87d 100644 --- a/django/core/files/locks.py +++ b/django/core/files/locks.py @@ -32,12 +32,12 @@ if os.name == "nt": POINTER, Structure, Union, + WinDLL, byref, c_int64, c_ulong, c_void_p, sizeof, - windll, ) from ctypes.wintypes import BOOL, DWORD, HANDLE @@ -73,10 +73,11 @@ if os.name == "nt": LPOVERLAPPED = POINTER(OVERLAPPED) # --- Define function prototypes for extra safety --- - LockFileEx = windll.kernel32.LockFileEx + kernel32 = WinDLL("kernel32") + LockFileEx = kernel32.LockFileEx LockFileEx.restype = BOOL LockFileEx.argtypes = [HANDLE, DWORD, DWORD, DWORD, DWORD, LPOVERLAPPED] - UnlockFileEx = windll.kernel32.UnlockFileEx + UnlockFileEx = kernel32.UnlockFileEx UnlockFileEx.restype = BOOL UnlockFileEx.argtypes = [HANDLE, DWORD, DWORD, DWORD, LPOVERLAPPED] |
