summaryrefslogtreecommitdiff
path: root/Modules/ossaudiodev.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 22:38:47 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 22:38:47 +0000
commit1f900f1f69c93e409595f34a6da9e2b10e331421 (patch)
treecc8c26434cbfcac1bb6c80773bf124b3639e2ab5 /Modules/ossaudiodev.c
parent7c265a19433644fafcb8eca56633a83307f69739 (diff)
downloadcpython-git-1f900f1f69c93e409595f34a6da9e2b10e331421.tar.gz
#3247: get rid of Py_FindMethod
Third step: unix-only modules. Really remove the function this time.
Diffstat (limited to 'Modules/ossaudiodev.c')
-rw-r--r--Modules/ossaudiodev.c55
1 files changed, 45 insertions, 10 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 43215b0723..8f66144e66 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -803,9 +803,14 @@ static PyMethodDef oss_mixer_methods[] = {
};
static PyObject *
-oss_getattr(oss_audio_t *self, char *name)
+oss_getattro(oss_audio_t *self, PyObject *nameobj)
{
+ char *name = "";
PyObject * rval = NULL;
+
+ if (PyUnicode_Check(nameobj))
+ name = PyUnicode_AsString(nameobj);
+
if (strcmp(name, "closed") == 0) {
rval = (self->fd == -1) ? Py_True : Py_False;
Py_INCREF(rval);
@@ -829,17 +834,11 @@ oss_getattr(oss_audio_t *self, char *name)
}
}
else {
- rval = Py_FindMethod(oss_methods, (PyObject *)self, name);
+ rval = PyObject_GenericGetAttr((PyObject *)self, nameobj);
}
return rval;
}
-static PyObject *
-oss_mixer_getattr(oss_mixer_t *self, char *name)
-{
- return Py_FindMethod(oss_mixer_methods, (PyObject *)self, name);
-}
-
static PyTypeObject OSSAudioType = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"ossaudiodev.oss_audio_device", /*tp_name*/
@@ -848,10 +847,28 @@ static PyTypeObject OSSAudioType = {
/* methods */
(destructor)oss_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc)oss_getattr, /*tp_getattr*/
+ 0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ (getattrofunc)oss_getattro, /*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*/
+ oss_methods, /*tp_methods*/
};
static PyTypeObject OSSMixerType = {
@@ -862,10 +879,28 @@ static PyTypeObject OSSMixerType = {
/* methods */
(destructor)oss_mixer_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- (getattrfunc)oss_mixer_getattr, /*tp_getattr*/
+ 0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 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*/
+ oss_mixer_methods, /*tp_methods*/
};