Mercurial > cpython-lru_cache-weakref
diff Include/objimpl.h @ 3764:29fe6a0de366 legacy-trunk
Hacks for MS_COREDLL
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sun, 21 Jul 1996 02:23:54 +0000 |
| parents | 65a68c51e9f2 |
| children | 65d2d8e67da3 |
line wrap: on
line diff
--- a/Include/objimpl.h Sun Jul 21 02:23:24 1996 +0000 +++ b/Include/objimpl.h Sun Jul 21 02:23:54 1996 +0000 @@ -47,12 +47,26 @@ n * tp_itemsize. This fills in the ob_size field as well. */ +#ifndef MS_COREDLL extern PyObject *_PyObject_New Py_PROTO((PyTypeObject *)); extern varobject *_PyObject_NewVar Py_PROTO((PyTypeObject *, int)); #define PyObject_NEW(type, typeobj) ((type *) _PyObject_New(typeobj)) #define PyObject_NEW_VAR(type, typeobj, n) ((type *) _PyObject_NewVar(typeobj, n)) +#else +/* For an MS-Windows DLL, we change the way an object is created, so that the + extension module's malloc is used, rather than the core DLL malloc, as there is + no guarantee they will use the same heap +*/ +extern PyObject *_PyObject_New Py_PROTO((PyTypeObject *, PyObject *)); +extern varobject *_PyObject_NewVar Py_PROTO((PyTypeObject *, int, varobject *)); + +#define PyObject_NEW(type, typeobj) ((type *) _PyObject_New(typeobj,(PyObject *)malloc((typeobj)->tp_basicsize))) +#define PyObject_NEW_VAR(type, typeobj, n) ((type *) _PyObject_NewVar(typeobj, n, (varobject *)malloc((typeobj)->tp_basicsize + n * (typeobj)->tp_itemsize))) + +#endif /* MS_COREDLL */ + #ifdef __cplusplus } #endif
