@@ -810,28 +810,33 @@ PyNumber_InPlaceAdd(PyObject *v, PyObject *w)
810810
811811 if (PyInstance_Check (v )) {
812812 if (PyInstance_HalfBinOp (v , w , "__iadd__" , & x ,
813- PyNumber_Add , 0 ) <= 0 )
813+ PyNumber_Add , 0 ) <= 0 )
814814 return x ;
815815 }
816- else if (HASINPLACE (v )
817- && ((v -> ob_type -> tp_as_sequence != NULL &&
818- (f = v -> ob_type -> tp_as_sequence -> sq_inplace_concat )
819- != NULL )
820- || (v -> ob_type -> tp_as_number != NULL &&
821- (f = v -> ob_type -> tp_as_number -> nb_inplace_add ) != NULL )))
822- return (* f )(v , w );
816+ else if (HASINPLACE (v )) {
817+ if (v -> ob_type -> tp_as_sequence != NULL )
818+ f = v -> ob_type -> tp_as_sequence -> sq_inplace_concat ;
819+ if (f == NULL && v -> ob_type -> tp_as_number != NULL )
820+ f = v -> ob_type -> tp_as_number -> nb_inplace_add ;
821+ if (f != NULL )
822+ return (* f )(v , w );
823+ }
823824
824825 BINOP (v , w , "__add__" , "__radd__" , PyNumber_Add );
825826
826- if (v -> ob_type -> tp_as_sequence != NULL &&
827- (f = v -> ob_type -> tp_as_sequence -> sq_concat ) != NULL )
828- return (* f )(v , w );
829- else if (v -> ob_type -> tp_as_number != NULL ) {
827+ if (v -> ob_type -> tp_as_sequence != NULL ) {
828+ f = v -> ob_type -> tp_as_sequence -> sq_concat ;
829+ if (f != NULL )
830+ return (* f )(v , w );
831+ }
832+ if (v -> ob_type -> tp_as_number != NULL ) {
830833 if (PyNumber_Coerce (& v , & w ) != 0 )
831834 return NULL ;
832- if (v -> ob_type -> tp_as_number != NULL &&
833- (f = v -> ob_type -> tp_as_number -> nb_add ) != NULL )
834- x = (* f )(v , w );
835+ if (v -> ob_type -> tp_as_number != NULL ) {
836+ f = v -> ob_type -> tp_as_number -> nb_add ;
837+ if (f != NULL )
838+ x = (* f )(v , w );
839+ }
835840 Py_DECREF (v );
836841 Py_DECREF (w );
837842 if (f != NULL )
0 commit comments