Eryk Sun <eryk...@gmail.com> added the comment:

According to the docs, raising ValueError in this case has been a deprecated 
feature since 3.6.2, and the ability to do so no longer exists in 3.8. The 
documentation needs to be updated to reflect the new behavior.

https://docs.python.org/3.8/library/ctypes.html#calling-functions

In issue 35947, the customized libffi_msvc was replaced by standard libffi. 
ffi_call() in libffi_msvc returned a stack cleanup delta. This allowed raising 
ValueError in _call_function_pointer if the delta value was non-zero for an x86 
32-bit stdcall function (callee cleanup). A positive delta implied too many 
arguments, and a negative delta implied too few arguments. The standard libffi 
ffi_call() has no return value, so the code for raising ValueError was removed.

---

On a related note, PyCFuncPtr_call can be relaxed to allow the argument count 
to exceed the length of argtypes for x64 stdcall (but not x86). The 64-bit 
calling convention is the same for cdecl, stdcall, fastcall, and thiscall. It 
uses caller cleanup, like x86 cdecl, so we can skip raising TypeError in this 
case, just like we already do for cdecl.

----------
assignee:  -> docs@python
components: +Documentation, Windows
nosy: +docs@python, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> needs patch
versions: +Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38258>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to