@@ -141,22 +141,20 @@ find_po(PANEL *pan)
141141 PARSESTR - format string for argument parsing */
142142
143143#define Panel_NoArgNoReturnFunction (X ) \
144- static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
145- { if (!PyArg_NoArgs(args)) return NULL; \
146- return PyCursesCheckERR(X(self->pan), # X); }
144+ static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
145+ { return PyCursesCheckERR(X(self->pan), # X); }
147146
148147#define Panel_NoArgTrueFalseFunction (X ) \
149- static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args ) \
148+ static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
150149{ \
151- if (!PyArg_NoArgs(args)) return NULL; \
152150 if (X (self->pan) == FALSE) { Py_INCREF(Py_False); return Py_False; } \
153151 else { Py_INCREF(Py_True); return Py_True; } }
154152
155153#define Panel_TwoArgNoReturnFunction (X , TYPE , PARSESTR ) \
156154static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
157155{ \
158156 TYPE arg1, arg2; \
159- if (!PyArg_Parse (args,PARSESTR, &arg1, &arg2)) return NULL; \
157+ if (!PyArg_ParseTuple (args, PARSESTR, &arg1, &arg2)) return NULL; \
160158 return PyCursesCheckERR(X(self->pan, arg1, arg2), # X); }
161159
162160/* ------------- PANEL routines --------------- */
@@ -166,7 +164,7 @@ Panel_NoArgNoReturnFunction(hide_panel)
166164Panel_NoArgNoReturnFunction (show_panel )
167165Panel_NoArgNoReturnFunction (top_panel )
168166Panel_NoArgTrueFalseFunction (panel_hidden )
169- Panel_TwoArgNoReturnFunction (move_panel , int , "(ii) ;y,x" )
167+ Panel_TwoArgNoReturnFunction (move_panel , int , "ii ;y ,x ")
170168
171169/* Allocation and deallocation of Panel Objects */
172170
@@ -199,13 +197,11 @@ PyCursesPanel_Dealloc(PyCursesPanelObject *po)
199197/* panel_above(NULL) returns the bottom panel in the stack. To get
200198 this behaviour we use curses.panel.bottom_panel(). */
201199static PyObject *
202- PyCursesPanel_above (PyCursesPanelObject * self , PyObject * args )
200+ PyCursesPanel_above (PyCursesPanelObject * self )
203201{
204202 PANEL * pan ;
205203 PyCursesPanelObject * po ;
206204
207- if (!PyArg_NoArgs (args )) return NULL ;
208-
209205 pan = panel_above (self -> pan );
210206
211207 if (pan == NULL ) { /* valid output, it means the calling panel
@@ -226,13 +222,11 @@ PyCursesPanel_above(PyCursesPanelObject *self, PyObject *args)
226222/* panel_below(NULL) returns the top panel in the stack. To get
227223 this behaviour we use curses.panel.top_panel(). */
228224static PyObject *
229- PyCursesPanel_below (PyCursesPanelObject * self , PyObject * args )
225+ PyCursesPanel_below (PyCursesPanelObject * self )
230226{
231227 PANEL * pan ;
232228 PyCursesPanelObject * po ;
233229
234- if (!PyArg_NoArgs (args )) return NULL ;
235-
236230 pan = panel_below (self -> pan );
237231
238232 if (pan == NULL ) { /* valid output, it means the calling panel
@@ -251,10 +245,8 @@ PyCursesPanel_below(PyCursesPanelObject *self, PyObject *args)
251245}
252246
253247static PyObject *
254- PyCursesPanel_window (PyCursesPanelObject * self , PyObject * args )
248+ PyCursesPanel_window (PyCursesPanelObject * self )
255249{
256- if (!PyArg_NoArgs (args )) return NULL ;
257-
258250 Py_INCREF (self -> wo );
259251 return (PyObject * )self -> wo ;
260252}
@@ -266,7 +258,7 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
266258 PyCursesWindowObject * temp ;
267259 int rtn ;
268260
269- if (ARG_COUNT (args ) != 1 ) {
261+ if (PyTuple_Size (args ) != 1 ) {
270262 PyErr_SetString (PyExc_TypeError , "replace requires one argument" );
271263 return NULL ;
272264 }
@@ -294,27 +286,18 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
294286}
295287
296288static PyObject *
297- PyCursesPanel_set_panel_userptr (PyCursesPanelObject * self , PyObject * args )
289+ PyCursesPanel_set_panel_userptr (PyCursesPanelObject * self , PyObject * obj )
298290{
299- PyObject * obj ;
300-
301- if (ARG_COUNT (args ) != 1 ) {
302- PyErr_SetString (PyExc_TypeError , "set_userptr requires one argument" );
303- return NULL ;
304- }
305- obj = PyTuple_GetItem (args , 0 );
306291 Py_INCREF (obj );
307292 return PyCursesCheckERR (set_panel_userptr (self -> pan , (void * )obj ),
308293 "set_panel_userptr" );
309294}
310295
311- static PyObject * PyCursesPanel_userptr
312- (PyCursesPanelObject * self , PyObject * args )
296+ static PyObject *
297+ PyCursesPanel_userptr (PyCursesPanelObject * self )
313298{
314299 PyObject * obj ;
315300 PyCursesInitialised ;
316- if (!PyArg_NoArgs (args ))
317- return NULL ;
318301 obj = (PyObject * ) panel_userptr (self -> pan );
319302 Py_INCREF (obj );
320303 return obj ;
@@ -324,20 +307,19 @@ static PyObject *PyCursesPanel_userptr
324307/* Module interface */
325308
326309static PyMethodDef PyCursesPanel_Methods [] = {
327- {"above" , (PyCFunction )PyCursesPanel_above },
328- {"below" , (PyCFunction )PyCursesPanel_below },
329- {"bottom" , (PyCFunction )PyCursesPanel_bottom_panel },
330- {"hidden" , (PyCFunction )PyCursesPanel_panel_hidden },
331- {"hide" , (PyCFunction )PyCursesPanel_hide_panel },
332- {"move" , (PyCFunction )PyCursesPanel_move_panel },
310+ {"above" , (PyCFunction )PyCursesPanel_above , METH_NOARGS },
311+ {"below" , (PyCFunction )PyCursesPanel_below , METH_NOARGS },
312+ {"bottom" , (PyCFunction )PyCursesPanel_bottom_panel , METH_NOARGS },
313+ {"hidden" , (PyCFunction )PyCursesPanel_panel_hidden , METH_NOARGS },
314+ {"hide" , (PyCFunction )PyCursesPanel_hide_panel , METH_NOARGS },
315+ {"move" , (PyCFunction )PyCursesPanel_move_panel , METH_VARARGS },
333316 {"replace" , (PyCFunction )PyCursesPanel_replace_panel ,
334317 METH_VARARGS },
335- {"set_userptr" , (PyCFunction )PyCursesPanel_set_panel_userptr ,
336- METH_VARARGS },
337- {"show" , (PyCFunction )PyCursesPanel_show_panel },
338- {"top" , (PyCFunction )PyCursesPanel_top_panel },
339- {"userptr" , (PyCFunction )PyCursesPanel_userptr },
340- {"window" , (PyCFunction )PyCursesPanel_window },
318+ {"set_userptr" , (PyCFunction )PyCursesPanel_set_panel_userptr , METH_O },
319+ {"show" , (PyCFunction )PyCursesPanel_show_panel , METH_NOARGS },
320+ {"top" , (PyCFunction )PyCursesPanel_top_panel , METH_NOARGS },
321+ {"userptr" , (PyCFunction )PyCursesPanel_userptr , METH_NOARGS },
322+ {"window" , (PyCFunction )PyCursesPanel_window , METH_NOARGS },
341323 {NULL , NULL } /* sentinel */
342324};
343325
0 commit comments