1
0
mirror of https://github.com/django/django.git synced 2024-12-27 19:46:22 +00:00

[4.2.x] Fixed #34294 -- Protected django.core.files.locks against argtypes redefinition on Windows.

Backport of 7eb5391b71 from main
This commit is contained in:
Simon Sawicki 2023-01-26 19:39:33 +01:00 committed by Mariusz Felisiak
parent 719a14badc
commit 9eae81724d

View File

@ -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]