This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hoodchatham
Recipients hoodchatham
Date 2022-04-04.00:27:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1649032064.63.0.517222199646.issue47208@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-04-04 00:27:44hoodchathamsetrecipients: + hoodchatham
2022-04-04 00:27:44hoodchathamsetmessageid: <1649032064.63.0.517222199646.issue47208@roundup.psfhosted.org>
2022-04-04 00:27:44hoodchathamlinkissue47208 messages
2022-04-04 00:27:44hoodchathamcreate