8000 bpo-46323: Reduce stack usage of ctypes python callback function. by corona10 · Pull Request #31224 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-46323: Reduce stack usage of ctypes python callback function. #31224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-46323: Address code review
  • Loading branch information
corona10 committed Feb 9, 2022
commit 71a82b58ad1b74169bdf0c9d9439ae6c8ab674c7
11 changes: 3 additions & 8 deletions Modules/_ctypes/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,12 @@ static void _CallPythonObject(void *mem,

assert(PyTuple_Check(converters));
nargs = PyTuple_GET_SIZE(converters);
if (nargs < 0) {
PrintError("BUG: PySequence_Length");
goto Done;
}

assert(nargs <= CTYPES_MAX_ARGCOUNT);
if (nargs == 0) {
args = NULL;
if (nargs > 0) {
args = alloca(nargs * sizeof(PyObject *));
}
else {
args = alloca(nargs * sizeof(PyObject *));
args = NULL;
}

PyObject **cnvs = PySequence_Fast_ITEMS(converters);
Expand Down
0