@@ -147,12 +147,6 @@ functions can be accessed by indexing the dll object with the ordinal number::
147147Calling functions
148148^^^^^^^^^^^^^^^^^
149149
150- .. deprecated-removed :: 3.6.2 3.7
151-
152- Calling :mod: `ctypes ` functions is deprecated. Calling a native function
153- with incorrect arguments is unsupported and can easily cause
154- information leakage or code execution vulnerabilities.
155-
156150You can call these functions like any other Python callable. This example uses
157151the ``time() `` function, which returns system time in seconds since the Unix
158152epoch, and the ``GetModuleHandleA() `` function, which returns a win32 module
@@ -167,22 +161,14 @@ as the NULL pointer)::
167161 0x1d000000
168162 >>>
169163
170- :mod: `ctypes ` tries to protect you from calling functions with the wrong number
171- of arguments or the wrong calling convention. Unfortunately this only works on
172- Windows. It does this by examining the stack after the function returns, so
173- although an error is raised the function *has * been called::
164+ .. note ::
174165
175- >>> windll.kernel32.GetModuleHandleA() # doctest: +WINDOWS
176- Traceback (most recent call last):
177- File "<stdin>", line 1, in <module>
178- ValueError: Procedure probably called with not enough arguments (4 bytes missing)
179- >>> windll.kernel32.GetModuleHandleA(0, 0) # doctest: +WINDOWS
180- Traceback (most recent call last):
181- File "<stdin>", line 1, in <module>
182- ValueError: Procedure probably called with too many arguments (4 bytes in excess)
183- >>>
166+ :mod: `ctypes ` may raise a :exc: `ValueError ` after calling the function, if
167+ it detects that an invalid number of arguments were passed. This behavior
168+ should not be relied upon. It is deprecated in 3.6.2, and will be removed
169+ in 3.7.
184170
185- The same exception is raised when you call an ``stdcall `` function with the
171+ :exc: ` ValueError ` is raised when you call an ``stdcall `` function with the
186172``cdecl `` calling convention, or vice versa::
187173
188174 >>> cdll.kernel32.GetModuleHandleA(None) # doctest: +WINDOWS
0 commit comments