Issue47208
Created on 2022-04-04 00:27 by hoodchatham, last changed 2022-04-11 14:59 by admin.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 32297 | merged | christian.heimes, 2022-04-04 06:59 | |
| Messages (4) | |||
|---|---|---|---|
| msg416646 - (view) | Author: Hood Chatham (hoodchatham) * | Date: 2022-04-04 00:27 | |
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. |
|||
| msg416677 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2022-04-04 17:13 | |
New changeset d1b1c885d8f276a0b1ff2e327270916396a8b842 by Christian Heimes in branch 'main': bpo-47208: Allow vendors to override CTYPES_MAX_ARGCOUNT (GH-32297) https://github.com/python/cpython/commit/d1b1c885d8f276a0b1ff2e327270916396a8b842 |
|||
| msg416678 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2022-04-04 17:15 | |
GH-32297 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. |
|||
| msg416692 - (view) | Author: Hood Chatham (hoodchatham) * | Date: 2022-04-04 19:07 | |
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`. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:58 | admin | set | github: 91364 |
| 2022-04-04 19:07:48 | hoodchatham | set | messages: + msg416692 |
| 2022-04-04 17:15:36 | christian.heimes | set | type: behavior components: + Tests versions: + Python 3.11 |
| 2022-04-04 17:15:19 | christian.heimes | set | messages: + msg416678 |
| 2022-04-04 17:13:50 | christian.heimes | set | messages: + msg416677 |
| 2022-04-04 06:59:50 | christian.heimes | set | keywords:
+ patch stage: patch review pull_requests: + pull_request30356 |
| 2022-04-04 00:28:20 | hoodchatham | set | nosy:
+ amaury.forgeotdarc, belopolsky, christian.heimes, meador.inge |
| 2022-04-04 00:27:44 | hoodchatham | create | |
