@@ -85,7 +85,7 @@ template_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
8585 }
8686 last_was_str = 1 ;
8787 }
88- else if (PyObject_TypeCheck (item , & _PyInterpolation_Type )) {
88+ else if (_PyInterpolation_Check (item )) {
8989 if (!last_was_str ) {
9090 stringslen ++ ;
9191 }
@@ -134,7 +134,7 @@ template_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
134134 }
135135 last_was_str = 1 ;
136136 }
137- else if (PyObject_TypeCheck (item , & _PyInterpolation_Type )) {
137+ else if (_PyInterpolation_Check (item )) {
138138 if (!last_was_str ) {
139139 PyTuple_SET_ITEM (strings , stringsidx ++ , & _Py_STR (empty ));
140140 }
@@ -397,14 +397,13 @@ template_concat_str_template(templateobject *self, PyObject *other)
397397PyObject *
398398_PyTemplate_Concat (PyObject * self , PyObject * other )
399399{
400- if (PyObject_TypeCheck (self , & _PyTemplate_Type ) &&
401- PyObject_TypeCheck (other , & _PyTemplate_Type )) {
400+ if (_PyTemplate_Check (self ) && _PyTemplate_Check (other )) {
402401 return template_concat_templates ((templateobject * ) self , (templateobject * ) other );
403402 }
404- else if (PyObject_TypeCheck ( self , & _PyTemplate_Type ) && PyUnicode_Check (other )) {
403+ else if (( _PyTemplate_Check ( self ) ) && PyUnicode_Check (other )) {
405404 return template_concat_template_str ((templateobject * ) self , other );
406405 }
407- else if (PyUnicode_Check (self ) && PyObject_TypeCheck ( other , & _PyTemplate_Type )) {
406+ else if (PyUnicode_Check (self ) && ( _PyTemplate_Check ( other ) )) {
408407 return template_concat_str_template ((templateobject * ) other , self );
409408 }
410409 else {
0 commit comments