Skip to content

Commit 898a104

Browse files
committed
minor macro edit
1 parent acba269 commit 898a104

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Modules/_functoolsmodule.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,13 @@ partial_descr_get(PyObject *self, PyObject *obj, PyObject *type)
334334
return PyMethod_New(self, obj);
335335
}
336336

337-
#define ALLOCATE_STACK(type, size, small_stack, stack) \
337+
#define ALLOCATE_STACK(elsize, size, small_stack, stack) \
338338
do { \
339339
if (size <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { \
340340
stack = small_stack; \
341341
} \
342342
else { \
343-
stack = PyMem_Malloc(size * sizeof(type *)); \
343+
stack = PyMem_Malloc(size * elsize); \
344344
if (stack == NULL) { \
345345
PyErr_NoMemory(); \
346346
return NULL; \
@@ -425,7 +425,7 @@ partial_vectorcall(partialobject *pto, PyObject *const *args,
425425
/* Allocate Stack */
426426
tot_nkwds = pto_nkwds + nkwds;
427427
tot_nargskw = tot_nargs + tot_nkwds;
428-
ALLOCATE_STACK(PyObject, tot_nargskw, small_stack, stack);
428+
ALLOCATE_STACK(sizeof(PyObject *), tot_nargskw, small_stack, stack);
429429

430430
if (nkwds) {
431431
/* if !pto_nkwds & nkwds, then simply append kw */
@@ -438,7 +438,7 @@ partial_vectorcall(partialobject *pto, PyObject *const *args,
438438

439439
/* Temporary stack for keywords that are not in pto->kw */
440440
PyObject **kwtail, *small_kwtail[_PY_FASTCALL_SMALL_STACK * 2];
441-
ALLOCATE_STACK(PyObject, nkwds * 2, small_kwtail, kwtail);
441+
ALLOCATE_STACK(sizeof(PyObject *), nkwds * 2, small_kwtail, kwtail);
442442

443443
/* Merge kw to pto_kw or add to tail (if not duplicate) */
444444
Py_ssize_t n_tail = 0;
@@ -470,7 +470,7 @@ partial_vectorcall(partialobject *pto, PyObject *const *args,
470470
Py_ssize_t n_merges = nkwds - n_tail;
471471
tot_nkwds = pto_nkwds + nkwds - n_merges;
472472
tot_nargskw = tot_nargs + tot_nkwds;
473-
ALLOCATE_STACK(PyObject, tot_nargskw, small_stack, stack);
473+
ALLOCATE_STACK(sizeof(PyObject *), tot_nargskw, small_stack, stack);
474474
tot_kwnames = PyTuple_New(tot_nkwds);
475475

476476
/* Copy pto_kw to stack */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy