diff options
author | Georg Brandl <georg@python.org> | 2008-12-05 15:12:15 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-12-05 15:12:15 (GMT) |
commit | 913b2a382f237c89a43198001398c61b3196b0be (patch) | |
tree | cad950671e6b0bdef9722719a2449e0d4ec432e7 /Doc/includes/shoddy.c | |
parent | a872de55dc9d4e292c4b8fe7e09741081890305e (diff) | |
download | cpython-913b2a382f237c89a43198001398c61b3196b0be.zip cpython-913b2a382f237c89a43198001398c61b3196b0be.tar.gz cpython-913b2a382f237c89a43198001398c61b3196b0be.tar.bz2 |
#4504, #4505: Update noddy examples in "Extending & Embedding".
Diffstat (limited to 'Doc/includes/shoddy.c')
-rw-r--r-- | Doc/includes/shoddy.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Doc/includes/shoddy.c b/Doc/includes/shoddy.c index 4c46bea..3757bca 100644 --- a/Doc/includes/shoddy.c +++ b/Doc/includes/shoddy.c @@ -32,7 +32,6 @@ Shoddy_init(Shoddy *self, PyObject *args, PyObject *kwds) static PyTypeObject ShoddyType = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ "shoddy.Shoddy", /* tp_name */ sizeof(Shoddy), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -52,7 +51,7 @@ static PyTypeObject ShoddyType = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ @@ -73,18 +72,26 @@ static PyTypeObject ShoddyType = { 0, /* tp_new */ }; +static PyModuleDef shoddymodule = { + PyModuleDef_HEAD_INIT, + "shoddy", + "Shoddy module", + -1, + NULL, NULL, NULL, NULL, NULL +}; + PyMODINIT_FUNC -initshoddy(void) +PyInit_shoddy(void) { PyObject *m; ShoddyType.tp_base = &PyList_Type; if (PyType_Ready(&ShoddyType) < 0) - return; + return NULL; - m = Py_InitModule3("shoddy", NULL, "Shoddy module"); + m = PyModule_Create(&shoddymodule); if (m == NULL) - return; + return NULL; Py_INCREF(&ShoddyType); PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType); |