New submission from Hood Chatham <roberthoodchat...@gmail.com>:

ctypes defines `CTYPES_MAX_ARGCOUNT` to be 1024:
https://github.com/python/cpython/blob/6db2db91b96aaa1270c200ec931a2250fe2799c7/Modules/_ctypes/ctypes.h#L21

If a function call is attempted with more than 1024 arguments, it will fail. 
The libffi emscripten port github.com/hoodmane/libffi-emscripten can only 
support function calls with at most 122 arguments due to limitations in 
Emscripten / Wasm:
https://github.com/emscripten-core/emscripten/pull/16653

I propose to allow the libffi port to define FFI_MAX_CLOSURE_ARGS and if this 
is defined then use this number instead for `CTYPES_MAX_ARGCOUNT`.
https://github.com/libffi/libffi/issues/703

The test `test_callback_too_many_args` should also be updated to respect the 
value of `CTYPES_MAX_ARGCOUNT` rather than hardcoding 1024 into the test.

----------
components: ctypes
messages: 416646
nosy: hoodchatham
priority: normal
severity: normal
status: open
title: Support libffi implementations that cannot support invocations with 1024 
arguments

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

Reply via email to