[Python-Dev] Re: Suggested memory API rules for 2.3 (original) (raw)
Tim Peters tim.one@comcast.net
Thu, 04 Apr 2002 11:38:54 -0500
- Previous message: [Python-Dev] Re: Suggested memory API rules for 2.3
- Next message: [Python-Dev] Suggested memory API rules for 2.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Neil Schemenauer]
People will have to cast to PyObject* when calling PyObjectGCDel.
This depends on whether you want to leave its signature alone, or declare it as taking a void*.
I guess that will be consistent with the other Free and Del functions.
One reason I prefer the other _Free functions over their _Del versions is that they're already declared to take void*, just like C free(); e.g.,
extern DL_IMPORT(void) PyObject_Free(void *);
Some of our macros do redundant casts to void* now when invoking these guys.
In any case, if people stick to the "recommended" API {PyMem, PyObject)_Free, they should not need to cast their arguments.
Note that there's no type safety in the way we've actually implemented things even for the PyObject_Del spelling:
#define PyObject_Del(op) _PyObject_Del((PyObject *)(op))
That is, no matter what kind of goofy pointer a programmer may pass, we silently cast it to PyObject* anyway. Better then (IMO) to change _PyObject_Del's signature to void*, let it cast to PyObject* internally, and lose the macro trick.
- Previous message: [Python-Dev] Re: Suggested memory API rules for 2.3
- Next message: [Python-Dev] Suggested memory API rules for 2.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]