[Python-Dev] pymalloc on Windows (original) (raw)
Fredrik Lundh fredrik@pythonware.com
Mon, 18 Mar 2002 15:56:51 +0100
- Previous message: [Python-Dev] pymalloc on Windows
- Next message: [Python-Dev] pymalloc on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
guido wrote:
> > I have patches for both these modules. However, I wonder if a = more > > pragmatic option is to expose this core function. It would allow > > PyObjectNEW to continue to work as before. > > That would break lots of code... basically all code using > the macros instead of the functions, I guess. =20 Hm, I thought it was explicitly the case that only (the statically linked part of) the core would ever use these macros. So why would there be 3rd party code breakage?
because module implementors read the fine manual?
http://www.python.org/doc/current/api/allocating-objects.html
"TYPE* PyObject_NEW(TYPE, PyTypeObject *type)=20
"Return value: New reference.=20
"Macro version of PyObject_New(), to gain performance
at the expense of safety. This does not check type for
a NULL value. "
and given that most calls to PyObject_New (at least in our code) passes in the address of a statically allocated Type object, there's little reason to use a null-checking version...
(a quick grep indicates that we have about 100 PyObject_NEW for each call to PyObject_New...)
- Previous message: [Python-Dev] pymalloc on Windows
- Next message: [Python-Dev] pymalloc on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]