summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorJason Tishler <jason@tishler.net>2003-01-06 12:41:26 +0000
committerJason Tishler <jason@tishler.net>2003-01-06 12:41:26 +0000
commitfb8595df4f9583ab9e83826cd782e0c18ba9cffa (patch)
treefb178c5308b141f5285fd5b0bb560da02ee8c64c /Modules
parentf2128b004c5cac7ae8766329b061867de6fb6093 (diff)
downloadcpython-git-fb8595df4f9583ab9e83826cd782e0c18ba9cffa.tar.gz
Patch #661760: Cygwin auto-import module patch
The attached patch enables shared extension modules to build cleanly under Cygwin without moving the static initialization of certain function pointers (i.e., ones exported from the Python DLL core) to a module initialization function. Additionally, this patch fixes the modules that have been changed in the past to accommodate Cygwin.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_hotshot.c6
-rw-r--r--Modules/_randommodule.c9
-rw-r--r--Modules/_tkinter.c3
-rw-r--r--Modules/arraymodule.c11
-rw-r--r--Modules/bz2module.c43
-rw-r--r--Modules/cPickle.c6
-rw-r--r--Modules/socketmodule.c9
7 files changed, 28 insertions, 59 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c
index 53130d65a5..83222ce3ca 100644
--- a/Modules/_hotshot.c
+++ b/Modules/_hotshot.c
@@ -1258,7 +1258,7 @@ static PyTypeObject ProfilerType = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- 0, /* tp_getattro */
+ PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
@@ -1343,7 +1343,7 @@ static PyTypeObject LogReaderType = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- 0, /* tp_getattro */
+ PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
@@ -1634,9 +1634,7 @@ init_hotshot(void)
PyObject *module;
LogReaderType.ob_type = &PyType_Type;
- LogReaderType.tp_getattro = PyObject_GenericGetAttr;
ProfilerType.ob_type = &PyType_Type;
- ProfilerType.tp_getattro = PyObject_GenericGetAttr;
module = Py_InitModule("_hotshot", functions);
if (module != NULL) {
char *s = get_version_string();
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
index 1b96dc8c35..35f10a5d36 100644
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -486,7 +486,7 @@ static PyTypeObject Random_Type = {
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
- 0, /*tp_getattro*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
@@ -506,9 +506,9 @@ static PyTypeObject Random_Type = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
- 0, /*tp_alloc*/
+ PyType_GenericAlloc, /*tp_alloc*/
random_new, /*tp_new*/
- 0, /*tp_free*/
+ _PyObject_Del, /*tp_free*/
0, /*tp_is_gc*/
};
@@ -520,9 +520,6 @@ init_random(void)
{
PyObject *m;
- Random_Type.tp_getattro = PyObject_GenericGetAttr;
- Random_Type.tp_alloc = PyType_GenericAlloc;
- Random_Type.tp_free = _PyObject_Del;
if (PyType_Ready(&Random_Type) < 0)
return;
m = Py_InitModule3("_random", NULL, module_doc);
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 21d62b1dfa..1bb2d82a7c 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -834,7 +834,7 @@ statichere PyTypeObject PyTclObject_Type = {
0, /*tp_hash*/
0, /*tp_call*/
(reprfunc)PyTclObject_str, /*tp_str*/
- 0, /*tp_getattro*/
+ PyObject_GenericGetAttr,/*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
@@ -2931,7 +2931,6 @@ init_tkinter(void)
PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
PyTclObject_Type.ob_type = &PyType_Type;
- PyTclObject_Type.tp_getattro = &PyObject_GenericGetAttr;
PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
#ifdef TK_AQUA
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 933eae01bd..03447cb9e3 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -13,8 +13,6 @@
#endif /* DONT_HAVE_SYS_TYPES_H */
#endif /* !STDC_HEADERS */
-#define DELAYED(X) 0
-
struct arrayobject; /* Forward */
/* All possible arraydescr values are defined in the vector "descriptors"
@@ -1842,7 +1840,7 @@ static PyTypeObject Arraytype = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- DELAYED(PyObject_GenericGetAttr), /* tp_getattro */
+ PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
&array_as_buffer, /* tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
@@ -1862,9 +1860,9 @@ static PyTypeObject Arraytype = {
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
- DELAYED(PyType_GenericAlloc), /* tp_alloc */
+ PyType_GenericAlloc, /* tp_alloc */
array_new, /* tp_new */
- DELAYED(PyObject_Del), /* tp_free */
+ PyObject_Del, /* tp_free */
};
/* No functions in array module. */
@@ -1879,9 +1877,6 @@ initarray(void)
PyObject *m;
Arraytype.ob_type = &PyType_Type;
- Arraytype.tp_getattro = PyObject_GenericGetAttr;
- Arraytype.tp_alloc = PyType_GenericAlloc;
- Arraytype.tp_free = PyObject_Del;
m = Py_InitModule3("array", a_methods, module_doc);
Py_INCREF((PyObject *)&Arraytype);
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index d0383ac7ee..f358de7e91 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -1387,8 +1387,8 @@ static PyTypeObject BZ2File_Type = {
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
+ PyObject_GenericGetAttr,/*tp_getattro*/
+ PyObject_GenericSetAttr,/*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
BZ2File__doc__, /*tp_doc*/
@@ -1407,9 +1407,9 @@ static PyTypeObject BZ2File_Type = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
(initproc)BZ2File_init, /*tp_init*/
- 0, /*tp_alloc*/
+ PyType_GenericAlloc, /*tp_alloc*/
0, /*tp_new*/
- 0, /*tp_free*/
+ _PyObject_Del, /*tp_free*/
0, /*tp_is_gc*/
};
@@ -1652,8 +1652,8 @@ static PyTypeObject BZ2Comp_Type = {
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
+ PyObject_GenericGetAttr,/*tp_getattro*/
+ PyObject_GenericSetAttr,/*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
BZ2Comp__doc__, /*tp_doc*/
@@ -1672,9 +1672,9 @@ static PyTypeObject BZ2Comp_Type = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
(initproc)BZ2Comp_init, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
+ PyType_GenericAlloc, /*tp_alloc*/
+ PyType_GenericNew, /*tp_new*/
+ _PyObject_Del, /*tp_free*/
0, /*tp_is_gc*/
};
@@ -1869,8 +1869,8 @@ static PyTypeObject BZ2Decomp_Type = {
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
+ PyObject_GenericGetAttr,/*tp_getattro*/
+ PyObject_GenericSetAttr,/*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
BZ2Decomp__doc__, /*tp_doc*/
@@ -1889,9 +1889,9 @@ static PyTypeObject BZ2Decomp_Type = {
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
(initproc)BZ2Decomp_init, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
+ PyType_GenericAlloc, /*tp_alloc*/
+ PyType_GenericNew, /*tp_new*/
+ _PyObject_Del, /*tp_free*/
0, /*tp_is_gc*/
};
@@ -2089,24 +2089,9 @@ initbz2(void)
BZ2File_Type.ob_type = &PyType_Type;
BZ2File_Type.tp_base = &PyFile_Type;
BZ2File_Type.tp_new = PyFile_Type.tp_new;
- BZ2File_Type.tp_getattro = PyObject_GenericGetAttr;
- BZ2File_Type.tp_setattro = PyObject_GenericSetAttr;
- BZ2File_Type.tp_alloc = PyType_GenericAlloc;
- BZ2File_Type.tp_free = _PyObject_Del;
BZ2Comp_Type.ob_type = &PyType_Type;
- BZ2Comp_Type.tp_getattro = PyObject_GenericGetAttr;
- BZ2Comp_Type.tp_setattro = PyObject_GenericSetAttr;
- BZ2Comp_Type.tp_alloc = PyType_GenericAlloc;
- BZ2Comp_Type.tp_new = PyType_GenericNew;
- BZ2Comp_Type.tp_free = _PyObject_Del;
-
BZ2Decomp_Type.ob_type = &PyType_Type;
- BZ2Decomp_Type.tp_getattro = PyObject_GenericGetAttr;
- BZ2Decomp_Type.tp_setattro = PyObject_GenericSetAttr;
- BZ2Decomp_Type.tp_alloc = PyType_GenericAlloc;
- BZ2Decomp_Type.tp_new = PyType_GenericNew;
- BZ2Decomp_Type.tp_free = _PyObject_Del;
m = Py_InitModule3("bz2", bz2_methods, bz2__doc__);
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 9412ad9718..24a9f131e7 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -2543,8 +2543,8 @@ static PyTypeObject Picklertype = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- 0, /* set below */ /* tp_getattro */
- 0, /* set below */ /* tp_setattro */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
Picklertype__doc__, /* tp_doc */
@@ -4808,8 +4808,6 @@ initcPickle(void)
PyObject *compatible_formats;
Picklertype.ob_type = &PyType_Type;
- Picklertype.tp_getattro = PyObject_GenericGetAttr;
- Picklertype.tp_setattro = PyObject_GenericSetAttr;
Unpicklertype.ob_type = &PyType_Type;
PdataType.ob_type = &PyType_Type;
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 1bbd9411a9..2b0b796079 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2115,7 +2115,7 @@ static PyTypeObject sock_type = {
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
- 0, /* set below */ /* tp_getattro */
+ PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
@@ -2135,9 +2135,9 @@ static PyTypeObject sock_type = {
0, /* tp_descr_set */
0, /* tp_dictoffset */
sock_initobj, /* tp_init */
- 0, /* set below */ /* tp_alloc */
+ PyType_GenericAlloc, /* tp_alloc */
sock_new, /* tp_new */
- 0, /* set below */ /* tp_free */
+ PyObject_Del, /* tp_free */
};
@@ -3147,9 +3147,6 @@ init_socket(void)
return;
sock_type.ob_type = &PyType_Type;
- sock_type.tp_getattro = PyObject_GenericGetAttr;
- sock_type.tp_alloc = PyType_GenericAlloc;
- sock_type.tp_free = PyObject_Del;
m = Py_InitModule3(PySocket_MODULE_NAME,
socket_methods,
socket_doc);