You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=Nonecreated_at=<Date2022-04-04.00:27:44.616>labels= ['ctypes', 'type-bug', 'tests', '3.11']
title='Support libffi implementations that cannot support invocations with 1024 arguments'updated_at=<Date2022-04-04.19:07:48.227>user='https://github.com/hoodmane'
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: emscripten-core/emscripten#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. libffi/libffi#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.
#76478 adds #ifndef CTYPES_MAX_ARGCOUNT and exposes the constant in the _ctypes extension module, so the test case can use the constant. It allows you to override CTYPES_MAX_ARGCOUNT until libffi upstream agrees on FFI_MAX_CLOSURE_ARGS.
Ideally the library should be able to define a different macro, e.g., CTYPES_CUSTOM_MAX_ARGCOUNT. This way the libffi port can define CTYPES_CUSTOM_MAX_ARGCOUNT and it will be compatible with older Python versions without causing Warning: "CTYPES_MAX_ARGCOUNT redefined`.