diff options
author | Fred Drake <fdrake@acm.org> | 1999-02-16 22:15:42 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-02-16 22:15:42 (GMT) |
commit | 6724835959a1d38da7bb7e047b16610c17623a11 (patch) | |
tree | 4c61b67f14a80d26479c5d992500e43418f95df7 /Modules | |
parent | 71ddcd87e29432b6ee1d5dc5ea5ebeecd98d6e60 (diff) | |
download | cpython-6724835959a1d38da7bb7e047b16610c17623a11.zip cpython-6724835959a1d38da7bb7e047b16610c17623a11.tar.gz cpython-6724835959a1d38da7bb7e047b16610c17623a11.tar.bz2 |
Use the portable form of initializing the ob_type field for new types.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/xxmodule.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index 529f521..04a474c 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -132,8 +132,10 @@ Xxo_setattr(self, name, v) return PyDict_SetItemString(self->x_attr, name, v); } -staticforward PyTypeObject Xxo_Type = { - PyObject_HEAD_INIT(&PyType_Type) +statichere PyTypeObject Xxo_Type = { + /* The ob_type field must be initialized in the module init function + * to be portable to Windows without using C++. */ + PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "Xxo", /*tp_name*/ sizeof(XxoObject), /*tp_basicsize*/ @@ -242,6 +244,10 @@ initxx() { PyObject *m, *d; + /* Initialize the type of the new type object here; doing it here + * is required for portability to Windows without requiring C++. */ + Xxo_Type.ob_type = &PyType_Type; + /* Create the module and add the functions */ m = Py_InitModule("xx", xx_methods); |