@@ -171,36 +171,7 @@ _PyWarnings_InitState(PyInterpreterState *interp)
171171/*************************************************************************/
172172
173173static int
174- check_matched (PyInterpreterState * interp , PyObject * obj , PyObject * arg )
175- {
176- PyObject * result ;
177- int rc ;
178-
179- /* A 'None' filter always matches */
180- if (obj == Py_None )
181- return 1 ;
182-
183- /* An internal plain text default filter must match exactly */
184- if (PyUnicode_CheckExact (obj )) {
185- int cmp_result = PyUnicode_Compare (obj , arg );
186- if (cmp_result == -1 && PyErr_Occurred ()) {
187- return -1 ;
188- }
189- return !cmp_result ;
190- }
191-
192- /* Otherwise assume a regex filter and call its match() method */
193- result = PyObject_CallMethodOneArg (obj , & _Py_ID (match ), arg );
194- if (result == NULL )
195- return -1 ;
196-
197- rc = PyObject_IsTrue (result );
198- Py_DECREF (result );
199- return rc ;
200- }
201-
202- static int
203- check_matched_module (PyInterpreterState * interp , PyObject * obj , PyObject * arg , PyObject * arg2 )
174+ check_matched (PyInterpreterState * interp , PyObject * obj , PyObject * arg , PyObject * arg2 )
204175{
205176 PyObject * result ;
206177 int rc ;
@@ -497,14 +468,14 @@ filter_search(PyInterpreterState *interp, PyObject *category,
497468 break ;
498469 }
499470
500- good_msg = check_matched (interp , msg , text );
471+ good_msg = check_matched (interp , msg , text , NULL );
501472 if (good_msg == -1 ) {
502473 Py_DECREF (tmp_item );
503474 result = false;
504475 break ;
505476 }
506477
507- good_mod = check_matched_module (interp , mod , module , filename );
478+ good_mod = check_matched (interp , mod , module , filename );
508479 if (good_mod == -1 ) {
509480 Py_DECREF (tmp_item );
510481 result = false;
0 commit comments