summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-07-21 02:23:54 (GMT)
committerGuido van Rossum <guido@python.org>1996-07-21 02:23:54 (GMT)
commit5a849148030f622576615e68bfd6b29046e026ab (patch)
treed5f4ade7ac67be443022a9da78340bb2d1b36f20
parentbb864062f1c5ba1f89f41cb65b07ff26c7cf777d (diff)
downloadcpython-5a849148030f622576615e68bfd6b29046e026ab.zip
cpython-5a849148030f622576615e68bfd6b29046e026ab.tar.gz
cpython-5a849148030f622576615e68bfd6b29046e026ab.tar.bz2
Hacks for MS_COREDLL
-rw-r--r--Include/objimpl.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 139e337..724ba98 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -47,12 +47,26 @@ object with n extra items. The size is computed as tp_basicsize plus
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