@@ -551,55 +551,25 @@ sre_search(SRE_STATE* state, SRE_CODE* pattern)
551551 return sre_ucs4_search (state , pattern );
552552}
553553
554- static PyObject *
555- fix_string_param (PyObject * string , PyObject * string2 , const char * oldname )
556- {
557- if (string2 != NULL ) {
558- if (string != NULL ) {
559- PyErr_Format (PyExc_TypeError ,
560- "Argument given by name ('%s') and position (1)" ,
561- oldname );
562- return NULL ;
563- }
564- if (PyErr_WarnFormat (PyExc_DeprecationWarning , 1 ,
565- "The '%s' keyword parameter name is deprecated. "
566- "Use 'string' instead." , oldname ) < 0 )
567- return NULL ;
568- return string2 ;
569- }
570- if (string == NULL ) {
571- PyErr_SetString (PyExc_TypeError ,
572- "Required argument 'string' (pos 1) not found" );
573- return NULL ;
574- }
575- return string ;
576- }
577-
578554/*[clinic input]
579555_sre.SRE_Pattern.match
580556
581- string: object = NULL
557+ string: object
582558 pos: Py_ssize_t = 0
583559 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
584- *
585- pattern: object = NULL
586560
587561Matches zero or more characters at the beginning of the string.
588562[clinic start generated code]*/
589563
590564static PyObject *
591565_sre_SRE_Pattern_match_impl (PatternObject * self , PyObject * string ,
592- Py_ssize_t pos , Py_ssize_t endpos ,
593- PyObject * pattern )
594- /*[clinic end generated code: output=74b4b1da3bb2d84e input=3d079aa99979b81d]*/
566+ Py_ssize_t pos , Py_ssize_t endpos )
567+ /*[clinic end generated code: output=ea2d838888510661 input=a2ba191647abebe5]*/
595568{
596569 SRE_STATE state ;
597570 Py_ssize_t status ;
598571 PyObject * match ;
599572
600- string = fix_string_param (string , pattern , "pattern" );
601- if (!string )
602- return NULL ;
603573 if (!state_init (& state , (PatternObject * )self , string , pos , endpos ))
604574 return NULL ;
605575
@@ -623,29 +593,22 @@ _sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
623593/*[clinic input]
624594_sre.SRE_Pattern.fullmatch
625595
626- string: object = NULL
596+ string: object
627597 pos: Py_ssize_t = 0
628598 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
629- *
630- pattern: object = NULL
631599
632600Matches against all of the string
633601[clinic start generated code]*/
634602
635603static PyObject *
636604_sre_SRE_Pattern_fullmatch_impl (PatternObject * self , PyObject * string ,
637- Py_ssize_t pos , Py_ssize_t endpos ,
638- PyObject * pattern )
639- /*[clinic end generated code: output=1c98bc5da744ea94 input=d4228606cc12580f]*/
605+ Py_ssize_t pos , Py_ssize_t endpos )
606+ /*[clinic end generated code: output=5833c47782a35f4a input=a6f640614aaefceb]*/
640607{
641608 SRE_STATE state ;
642609 Py_ssize_t status ;
643610 PyObject * match ;
644611
645- string = fix_string_param (string , pattern , "pattern" );
646- if (!string )
647- return NULL ;
648-
649612 if (!state_init (& state , self , string , pos , endpos ))
650613 return NULL ;
651614
@@ -669,11 +632,9 @@ _sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
669632/*[clinic input]
670633_sre.SRE_Pattern.search
671634
672- string: object = NULL
635+ string: object
673636 pos: Py_ssize_t = 0
674637 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
675- *
676- pattern: object = NULL
677638
678639Scan through string looking for a match, and return a corresponding match object instance.
679640
@@ -682,18 +643,13 @@ Return None if no position in the string matches.
682643
683644static PyObject *
684645_sre_SRE_Pattern_search_impl (PatternObject * self , PyObject * string ,
685- Py_ssize_t pos , Py_ssize_t endpos ,
686- PyObject * pattern )
687- /*[clinic end generated code: output=3839394a18e5ea4f input=dab42720f4be3a4b]*/
646+ Py_ssize_t pos , Py_ssize_t endpos )
647+ /*[clinic end generated code: output=25f302a644e951e8 input=4ae5cb7dc38fed1b]*/
688648{
689649 SRE_STATE state ;
690650 Py_ssize_t status ;
691651 PyObject * match ;
692652
693- string = fix_string_param (string , pattern , "pattern" );
694- if (!string )
695- return NULL ;
696-
697653 if (!state_init (& state , self , string , pos , endpos ))
698654 return NULL ;
699655
@@ -762,30 +718,23 @@ deepcopy(PyObject** object, PyObject* memo)
762718/*[clinic input]
763719_sre.SRE_Pattern.findall
764720
765- string: object = NULL
721+ string: object
766722 pos: Py_ssize_t = 0
767723 endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
768- *
769- source: object = NULL
770724
771725Return a list of all non-overlapping matches of pattern in string.
772726[clinic start generated code]*/
773727
774728static PyObject *
775729_sre_SRE_Pattern_findall_impl (PatternObject * self , PyObject * string ,
776- Py_ssize_t pos , Py_ssize_t endpos ,
777- PyObject * source )
778- /*[clinic end generated code: output=51295498b300639d input=df688355c056b9de]*/
730+ Py_ssize_t pos , Py_ssize_t endpos )
731+ /*[clinic end generated code: output=f4966baceea60aca input=5b6a4ee799741563]*/
779732{
780733 SRE_STATE state ;
781734 PyObject * list ;
782735 Py_ssize_t status ;
783736 Py_ssize_t i , b , e ;
784737
785- string = fix_string_param (string , source , "source" );
786- if (!string )
787- return NULL ;
788-
789738 if (!state_init (& state , self , string , pos , endpos ))
790739 return NULL ;
791740
@@ -922,18 +871,16 @@ _sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string,
922871/*[clinic input]
923872_sre.SRE_Pattern.split
924873
925- string: object = NULL
874+ string: object
926875 maxsplit: Py_ssize_t = 0
927- *
928- source: object = NULL
929876
930877Split string by the occurrences of pattern.
931878[clinic start generated code]*/
932879
933880static PyObject *
934881_sre_SRE_Pattern_split_impl (PatternObject * self , PyObject * string ,
935- Py_ssize_t maxsplit , PyObject * source )
936- /*[clinic end generated code: output=20bac2ff55b9f84c input=41e0b2e35e599d7b ]*/
882+ Py_ssize_t maxsplit )
883+ /*[clinic end generated code: output=7ac66f381c45e0be input=1eeeb10dafc9947a ]*/
937884{
938885 SRE_STATE state ;
939886 PyObject * list ;
@@ -943,10 +890,6 @@ _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
943890 Py_ssize_t i ;
944891 void * last ;
945892
946- string = fix_string_param (string , source , "source" );
947- if (!string )
948- return NULL ;
949-
950893 assert (self -> codesize != 0 );
951894 if (self -> code [0 ] != SRE_OP_INFO || self -> code [3 ] == 0 ) {
952895 if (self -> code [0 ] == SRE_OP_INFO && self -> code [4 ] == 0 ) {
0 commit comments