Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1f900f1f
Commit
1f900f1f
authored
Jul 02, 2008
by
Amaury Forgeot d'Arc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#3247: get rid of Py_FindMethod
Third step: unix-only modules. Really remove the function this time.
parent
7c265a19
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
105 additions
and
96 deletions
+105
-96
Include/methodobject.h
Include/methodobject.h
+0
-10
Modules/_curses_panel.c
Modules/_curses_panel.c
+18
-9
Modules/_cursesmodule.c
Modules/_cursesmodule.c
+18
-9
Modules/_dbmmodule.c
Modules/_dbmmodule.c
+10
-8
Modules/_gdbmmodule.c
Modules/_gdbmmodule.c
+8
-7
Modules/ossaudiodev.c
Modules/ossaudiodev.c
+45
-10
Modules/xxmodule.c
Modules/xxmodule.c
+6
-6
Objects/methodobject.c
Objects/methodobject.c
+0
-37
No files found.
Include/methodobject.h
View file @
1f900f1f
...
...
@@ -43,8 +43,6 @@ struct PyMethodDef {
};
typedef
struct
PyMethodDef
PyMethodDef
;
PyAPI_FUNC
(
PyObject
*
)
Py_FindMethod
(
PyMethodDef
[],
PyObject
*
,
const
char
*
);
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
PyAPI_FUNC
(
PyObject
*
)
PyCFunction_NewEx
(
PyMethodDef
*
,
PyObject
*
,
PyObject
*
);
...
...
@@ -70,14 +68,6 @@ PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
#define METH_COEXIST 0x0040
typedef
struct
PyMethodChain
{
PyMethodDef
*
methods
;
/* Methods of this type */
struct
PyMethodChain
*
link
;
/* NULL or base type */
}
PyMethodChain
;
PyAPI_FUNC
(
PyObject
*
)
Py_FindMethodInChain
(
PyMethodChain
*
,
PyObject
*
,
const
char
*
);
typedef
struct
{
PyObject_HEAD
PyMethodDef
*
m_ml
;
/* Description of the C function to call */
...
...
Modules/_curses_panel.c
View file @
1f900f1f
...
...
@@ -329,12 +329,6 @@ static PyMethodDef PyCursesPanel_Methods[] = {
{
NULL
,
NULL
}
/* sentinel */
};
static
PyObject
*
PyCursesPanel_GetAttr
(
PyCursesPanelObject
*
self
,
char
*
name
)
{
return
Py_FindMethod
(
PyCursesPanel_Methods
,
(
PyObject
*
)
self
,
name
);
}
/* -------------------------------------------------------*/
PyTypeObject
PyCursesPanel_Type
=
{
...
...
@@ -345,14 +339,28 @@ PyTypeObject PyCursesPanel_Type = {
/* methods */
(
destructor
)
PyCursesPanel_Dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
PyCursesPanel_GetAttr
,
/*tp_getattr*/
(
setattrfunc
)
0
,
/*tp_setattr*/
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*/
PyCursesPanel_Methods
,
/*tp_methods*/
};
/* Wrapper for panel_above(NULL). This function returns the bottom
...
...
@@ -470,7 +478,8 @@ PyInit__curses_panel(void)
PyObject
*
m
,
*
d
,
*
v
;
/* Initialize object type */
Py_TYPE
(
&
PyCursesPanel_Type
)
=
&
PyType_Type
;
if
(
PyType_Ready
(
&
PyCursesPanel_Type
)
<
0
)
return
NULL
;
import_curses
();
...
...
Modules/_cursesmodule.c
View file @
1f900f1f
...
...
@@ -1650,12 +1650,6 @@ static PyMethodDef PyCursesWindow_Methods[] = {
{
NULL
,
NULL
}
/* sentinel */
};
static
PyObject
*
PyCursesWindow_GetAttr
(
PyCursesWindowObject
*
self
,
char
*
name
)
{
return
Py_FindMethod
(
PyCursesWindow_Methods
,
(
PyObject
*
)
self
,
name
);
}
/* -------------------------------------------------------*/
PyTypeObject
PyCursesWindow_Type
=
{
...
...
@@ -1666,14 +1660,28 @@ PyTypeObject PyCursesWindow_Type = {
/* methods */
(
destructor
)
PyCursesWindow_Dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
PyCursesWindow_GetAttr
,
/*tp_getattr*/
(
setattrfunc
)
0
,
/*tp_setattr*/
(
getattrfunc
)
0
,
/*tp_getattr*/
(
setattrfunc
)
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*/
PyCursesWindow_Methods
,
/*tp_methods*/
};
/*********************************************************************
...
...
@@ -2792,7 +2800,8 @@ PyInit__curses(void)
static
void
*
PyCurses_API
[
PyCurses_API_pointers
];
/* Initialize object type */
Py_TYPE
(
&
PyCursesWindow_Type
)
=
&
PyType_Type
;
if
(
PyType_Ready
(
&
PyCursesWindow_Type
)
<
0
)
return
NULL
;
/* Initialize the C API pointer array */
PyCurses_API
[
0
]
=
(
void
*
)
&
PyCursesWindow_Type
;
...
...
Modules/_dbmmodule.c
View file @
1f900f1f
...
...
@@ -324,12 +324,6 @@ static PyMethodDef dbm_methods[] = {
{
NULL
,
NULL
}
/* sentinel */
};
static
PyObject
*
dbm_getattr
(
dbmobject
*
dp
,
char
*
name
)
{
return
Py_FindMethod
(
dbm_methods
,
(
PyObject
*
)
dp
,
name
);
}
static
PyTypeObject
Dbmtype
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"_dbm.dbm"
,
...
...
@@ -337,7 +331,7 @@ static PyTypeObject Dbmtype = {
0
,
(
destructor
)
dbm_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
dbm_getattr
,
/*tp_getattr*/
0
,
/*tp_getattr*/
0
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
...
...
@@ -350,7 +344,15 @@ static PyTypeObject Dbmtype = {
0
,
/*tp_getattro*/
0
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_xxx4*/
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*/
dbm_methods
,
/*tp_methods*/
};
/* ----------------------------------------------------------------- */
...
...
Modules/_gdbmmodule.c
View file @
1f900f1f
...
...
@@ -381,12 +381,6 @@ static PyMethodDef dbm_methods[] = {
{
NULL
,
NULL
}
/* sentinel */
};
static
PyObject
*
dbm_getattr
(
dbmobject
*
dp
,
char
*
name
)
{
return
Py_FindMethod
(
dbm_methods
,
(
PyObject
*
)
dp
,
name
);
}
static
PyTypeObject
Dbmtype
=
{
PyVarObject_HEAD_INIT
(
0
,
0
)
"_gdbm.gdbm"
,
...
...
@@ -394,7 +388,7 @@ static PyTypeObject Dbmtype = {
0
,
(
destructor
)
dbm_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
dbm_getattr
,
/*tp_getattr*/
0
,
/*tp_getattr*/
0
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
...
...
@@ -409,6 +403,13 @@ static PyTypeObject Dbmtype = {
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_xxx4*/
gdbm_object__doc__
,
/*tp_doc*/
0
,
/*tp_traverse*/
0
,
/*tp_clear*/
0
,
/*tp_richcompare*/
0
,
/*tp_weaklistoffset*/
0
,
/*tp_iter*/
0
,
/*tp_iternext*/
dbm_methods
,
/*tp_methods*/
};
/* ----------------------------------------------------------------- */
...
...
Modules/ossaudiodev.c
View file @
1f900f1f
...
...
@@ -803,9 +803,14 @@ static PyMethodDef oss_mixer_methods[] = {
};
static
PyObject
*
oss_getattr
(
oss_audio_t
*
self
,
char
*
name
)
oss_getattr
o
(
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
=
Py
Object_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*/
};
...
...
Modules/xxmodule.c
View file @
1f900f1f
...
...
@@ -63,16 +63,16 @@ static PyMethodDef Xxo_methods[] = {
};
static
PyObject
*
Xxo_getattr
(
XxoObject
*
self
,
char
*
name
)
Xxo_getattr
o
(
XxoObject
*
self
,
PyObject
*
name
)
{
if
(
self
->
x_attr
!=
NULL
)
{
PyObject
*
v
=
PyDict_GetItem
String
(
self
->
x_attr
,
name
);
PyObject
*
v
=
PyDict_GetItem
(
self
->
x_attr
,
name
);
if
(
v
!=
NULL
)
{
Py_INCREF
(
v
);
return
v
;
}
}
return
Py
_FindMethod
(
Xxo_methods
,
(
PyObject
*
)
self
,
name
);
return
Py
Object_GenericGetattr
(
(
PyObject
*
)
self
,
name
);
}
static
int
...
...
@@ -104,7 +104,7 @@ static PyTypeObject Xxo_Type = {
/* methods */
(
destructor
)
Xxo_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
Xxo_getattr
,
/*tp_getattr*/
(
getattrfunc
)
0
,
/*tp_getattr*/
(
setattrfunc
)
Xxo_setattr
,
/*tp_setattr*/
0
,
/*tp_compare*/
0
,
/*tp_repr*/
...
...
@@ -114,7 +114,7 @@ static PyTypeObject Xxo_Type = {
0
,
/*tp_hash*/
0
,
/*tp_call*/
0
,
/*tp_str*/
0
,
/*tp_getattro*/
(
getattrofunc
)
Xxo_getattro
,
/*tp_getattro*/
0
,
/*tp_setattro*/
0
,
/*tp_as_buffer*/
Py_TPFLAGS_DEFAULT
,
/*tp_flags*/
...
...
@@ -125,7 +125,7 @@ static PyTypeObject Xxo_Type = {
0
,
/*tp_weaklistoffset*/
0
,
/*tp_iter*/
0
,
/*tp_iternext*/
0
,
/*tp_methods*/
Xxo_methods
,
/*tp_methods*/
0
,
/*tp_members*/
0
,
/*tp_getset*/
0
,
/*tp_base*/
...
...
Objects/methodobject.c
View file @
1f900f1f
...
...
@@ -280,43 +280,6 @@ PyTypeObject PyCFunction_Type = {
0
,
/* tp_dict */
};
/* Find a method in a method chain */
PyObject
*
Py_FindMethodInChain
(
PyMethodChain
*
chain
,
PyObject
*
self
,
const
char
*
name
)
{
if
(
name
[
0
]
==
'_'
&&
name
[
1
]
==
'_'
)
{
if
(
strcmp
(
name
,
"__doc__"
)
==
0
)
{
const
char
*
doc
=
self
->
ob_type
->
tp_doc
;
if
(
doc
!=
NULL
)
return
PyUnicode_FromString
(
doc
);
}
}
while
(
chain
!=
NULL
)
{
PyMethodDef
*
ml
=
chain
->
methods
;
for
(;
ml
->
ml_name
!=
NULL
;
ml
++
)
{
if
(
name
[
0
]
==
ml
->
ml_name
[
0
]
&&
strcmp
(
name
+
1
,
ml
->
ml_name
+
1
)
==
0
)
/* XXX */
return
PyCFunction_New
(
ml
,
self
);
}
chain
=
chain
->
link
;
}
PyErr_SetString
(
PyExc_AttributeError
,
name
);
return
NULL
;
}
/* Find a method in a single method list */
PyObject
*
Py_FindMethod
(
PyMethodDef
*
methods
,
PyObject
*
self
,
const
char
*
name
)
{
PyMethodChain
chain
;
chain
.
methods
=
methods
;
chain
.
link
=
NULL
;
return
Py_FindMethodInChain
(
&
chain
,
self
,
name
);
}
/* Clear out the free list */
int
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment