Issue 10732: Wrong destructor function type in Python/getargs.c (original) (raw)

Issue10732

Created on 2010-12-18 19:11 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg124307 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-18 19:11
In getargs.c, in addcleanup_convert(), PyCapsule_SetContext() is called with a second argument "int (*destr)(PyObject*,void*)", but it really expects a "void (*PyCapsule_Destructor)(PyObject *)". I'm not sure it's a good idea, although the ABI may be lenient enough on common architectures (?)...
msg124308 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-12-18 19:25
I fail to see the problem. The context is a plain void*, not (necessarily) a function pointer, and getargs uses it with the same type it put in. Why do you think PyCapsule_Destructor is of relevance?
msg124310 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-18 19:28
> I fail to see the problem. The context is a plain void*, not > (necessarily) a function pointer, and getargs uses it with the same > type it put in. Why do you think PyCapsule_Destructor is of relevance? Woops, sorry. Apparently I messed up PyCapsule_SetContext and PyCapsule_SetDestructor when reading the function declaration.
History
Date User Action Args
2022-04-11 14:57:10 admin set github: 54941
2010-12-18 19:28:17 pitrou set status: open -> closednosy:loewis, pitrou, vstinnerresolution: not a bug
2010-12-18 19:28:05 pitrou set nosy:loewis, pitrou, vstinnermessages: +
2010-12-18 19:25:18 loewis set nosy:loewis, pitrou, vstinnermessages: +
2010-12-18 19:11:48 pitrou create