@@ -382,36 +382,28 @@ parser_sizeof(PyST_Object *st, void *unused)
382382static PyObject *
383383parser_st2tuple (PyST_Object * self , PyObject * args , PyObject * kw )
384384{
385- PyObject * line_option = 0 ;
386- PyObject * col_option = 0 ;
385+ int line_info = 0 ;
386+ int col_info = 0 ;
387387 PyObject * res = 0 ;
388388 int ok ;
389389
390390 static char * keywords [] = {"st" , "line_info" , "col_info" , NULL };
391391
392392 if (self == NULL || PyModule_Check (self )) {
393- ok = PyArg_ParseTupleAndKeywords (args , kw , "O!|OO :st2tuple" , keywords ,
394- & PyST_Type , & self , & line_option ,
395- & col_option );
393+ ok = PyArg_ParseTupleAndKeywords (args , kw , "O!|pp :st2tuple" , keywords ,
394+ & PyST_Type , & self , & line_info ,
395+ & col_info );
396396 }
397397 else
398- ok = PyArg_ParseTupleAndKeywords (args , kw , "|OO :totuple" , & keywords [1 ],
399- & line_option , & col_option );
398+ ok = PyArg_ParseTupleAndKeywords (args , kw , "|pp :totuple" , & keywords [1 ],
399+ & line_info , & col_info );
400400 if (ok != 0 ) {
401- int lineno = 0 ;
402- int col_offset = 0 ;
403- if (line_option != NULL ) {
404- lineno = (PyObject_IsTrue (line_option ) != 0 ) ? 1 : 0 ;
405- }
406- if (col_option != NULL ) {
407- col_offset = (PyObject_IsTrue (col_option ) != 0 ) ? 1 : 0 ;
408- }
409401 /*
410402 * Convert ST into a tuple representation. Use Guido's function,
411403 * since it's known to work already.
412404 */
413405 res = node2tuple (((PyST_Object * )self )-> st_node ,
414- PyTuple_New , PyTuple_SetItem , lineno , col_offset );
406+ PyTuple_New , PyTuple_SetItem , line_info , col_info );
415407 }
416408 return (res );
417409}
@@ -426,35 +418,27 @@ parser_st2tuple(PyST_Object *self, PyObject *args, PyObject *kw)
426418static PyObject *
427419parser_st2list (PyST_Object * self , PyObject * args , PyObject * kw )
428420{
429- PyObject * line_option = 0 ;
430- PyObject * col_option = 0 ;
421+ int line_info = 0 ;
422+ int col_info = 0 ;
431423 PyObject * res = 0 ;
432424 int ok ;
433425
434426 static char * keywords [] = {"st" , "line_info" , "col_info" , NULL };
435427
436428 if (self == NULL || PyModule_Check (self ))
437- ok = PyArg_ParseTupleAndKeywords (args , kw , "O!|OO :st2list" , keywords ,
438- & PyST_Type , & self , & line_option ,
439- & col_option );
429+ ok = PyArg_ParseTupleAndKeywords (args , kw , "O!|pp :st2list" , keywords ,
430+ & PyST_Type , & self , & line_info ,
431+ & col_info );
440432 else
441- ok = PyArg_ParseTupleAndKeywords (args , kw , "|OO :tolist" , & keywords [1 ],
442- & line_option , & col_option );
433+ ok = PyArg_ParseTupleAndKeywords (args , kw , "|pp :tolist" , & keywords [1 ],
434+ & line_info , & col_info );
443435 if (ok ) {
444- int lineno = 0 ;
445- int col_offset = 0 ;
446- if (line_option != 0 ) {
447- lineno = PyObject_IsTrue (line_option ) ? 1 : 0 ;
448- }
449- if (col_option != NULL ) {
450- col_offset = (PyObject_IsTrue (col_option ) != 0 ) ? 1 : 0 ;
451- }
452436 /*
453437 * Convert ST into a tuple representation. Use Guido's function,
454438 * since it's known to work already.
455439 */
456440 res = node2tuple (self -> st_node ,
457- PyList_New , PyList_SetItem , lineno , col_offset );
441+ PyList_New , PyList_SetItem , line_info , col_info );
458442 }
459443 return (res );
460444}
0 commit comments