summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 20:50:16 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 20:50:16 (GMT)
commite43d33a4db0c0c9afcb70a26f682abfe889e845b (patch)
tree47197bd06fa88bf96cef5f673018d20887fa301c /Modules/_ssl.c
parent4118174315f4cba03208886af868fe31f1cd5b9d (diff)
downloadcpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.zip
cpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.tar.gz
cpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.tar.bz2
#3247 Get rid of Py_FindMethod; use tp_members instead.
Otherwise dir(_sre.SRE_Match) returns an empty list. First step: handle most occurrences, remove tp_getattr and fill the tp_methods and tp_members slots. Add some test about attribute access.
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index f2e95b9..25b82b4 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1384,11 +1384,6 @@ static PyMethodDef PySSLMethods[] = {
{NULL, NULL}
};
-static PyObject *PySSL_getattr(PySSLObject *self, char *name)
-{
- return Py_FindMethod(PySSLMethods, (PyObject *)self, name);
-}
-
static PyTypeObject PySSL_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"ssl.SSLContext", /*tp_name*/
@@ -1397,7 +1392,7 @@ static PyTypeObject PySSL_Type = {
/* methods */
(destructor)PySSL_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc)PySSL_getattr, /*tp_getattr*/
+ 0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -1405,6 +1400,20 @@ static PyTypeObject PySSL_Type = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ PySSLMethods, /*tp_methods*/
};
#ifdef HAVE_OPENSSL_RAND
@@ -1581,7 +1590,8 @@ PyInit__ssl(void)
{
PyObject *m, *d;
- Py_TYPE(&PySSL_Type) = &PyType_Type;
+ if (PyType_Ready(&PySSL_Type) < 0)
+ return NULL;
m = PyModule_Create(&_sslmodule);
if (m == NULL)