Kaydet (Commit) 0d40ba4c authored tarafından Fred Drake's avatar Fred Drake

Patch from Paul Sokolovsky <Paul.Sokolovsky@technologist.com>:

      Attached is patch (against 1.5.2 release) to allow some modules
to be buildable as pyd's (usual &PyType_Type stuff).
üst 0fdffcf9
...@@ -1448,7 +1448,7 @@ itemsize -- the length in bytes of one array item\n\ ...@@ -1448,7 +1448,7 @@ itemsize -- the length in bytes of one array item\n\
"; ";
statichere PyTypeObject Arraytype = { statichere PyTypeObject Arraytype = {
PyObject_HEAD_INIT(&PyType_Type) PyObject_HEAD_INIT(NULL)
0, 0,
"array", "array",
sizeof(arrayobject), sizeof(arrayobject),
...@@ -1476,6 +1476,8 @@ DL_EXPORT(void) ...@@ -1476,6 +1476,8 @@ DL_EXPORT(void)
initarray() initarray()
{ {
PyObject *m, *d; PyObject *m, *d;
Arraytype.ob_type = &PyType_Type;
m = Py_InitModule3("array", a_methods, module_doc); m = Py_InitModule3("array", a_methods, module_doc);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
PyDict_SetItemString(d, "ArrayType", (PyObject *)&Arraytype); PyDict_SetItemString(d, "ArrayType", (PyObject *)&Arraytype);
......
...@@ -200,7 +200,7 @@ copy() -- return a copy of the current md5 object\n\ ...@@ -200,7 +200,7 @@ copy() -- return a copy of the current md5 object\n\
"; ";
statichere PyTypeObject MD5type = { statichere PyTypeObject MD5type = {
PyObject_HEAD_INIT(&PyType_Type) PyObject_HEAD_INIT(NULL)
0, /*ob_size*/ 0, /*ob_size*/
"md5", /*tp_name*/ "md5", /*tp_name*/
sizeof(md5object), /*tp_size*/ sizeof(md5object), /*tp_size*/
...@@ -271,6 +271,8 @@ DL_EXPORT(void) ...@@ -271,6 +271,8 @@ DL_EXPORT(void)
initmd5() initmd5()
{ {
PyObject *m, *d; PyObject *m, *d;
MD5type.ob_type = &PyType_Type;
m = Py_InitModule3("md5", md5_functions, module_doc); m = Py_InitModule3("md5", md5_functions, module_doc);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type); PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type);
......
...@@ -165,7 +165,7 @@ PyPcre_getattr(self, name) ...@@ -165,7 +165,7 @@ PyPcre_getattr(self, name)
staticforward PyTypeObject Pcre_Type = { staticforward PyTypeObject Pcre_Type = {
PyObject_HEAD_INIT(&PyType_Type) PyObject_HEAD_INIT(NULL)
0, /*ob_size*/ 0, /*ob_size*/
"Pcre", /*tp_name*/ "Pcre", /*tp_name*/
sizeof(PcreObject), /*tp_basicsize*/ sizeof(PcreObject), /*tp_basicsize*/
...@@ -664,6 +664,8 @@ initpcre() ...@@ -664,6 +664,8 @@ initpcre()
{ {
PyObject *m, *d; PyObject *m, *d;
Pcre_Type.ob_type = &PyType_Type;
/* Create the module and add the functions */ /* Create the module and add the functions */
m = Py_InitModule("pcre", pcre_methods); m = Py_InitModule("pcre", pcre_methods);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment