@@ -3777,7 +3777,7 @@ image_richcompare(const ImagingObject *self, const PyObject *other, const int op
37773777
37783778 // If the other object is not an ImagingObject.
37793779 if (!PyImaging_Check (other )) {
3780- return op == Py_EQ ? Py_False : Py_True ;
3780+ return Py_NewRef ( op == Py_EQ ? Py_False : Py_True ) ;
37813781 }
37823782
37833783 const Imaging img_a = self -> image ;
@@ -3788,7 +3788,7 @@ image_richcompare(const ImagingObject *self, const PyObject *other, const int op
37883788 || img_a -> xsize != img_b -> xsize
37893789 || img_a -> ysize != img_b -> ysize
37903790 ) {
3791- return op == Py_EQ ? Py_False : Py_True ;
3791+ return Py_NewRef ( op == Py_EQ ? Py_False : Py_True ) ;
37923792 }
37933793
37943794 const ImagingPalette palette_a = img_a -> palette ;
@@ -3810,20 +3810,22 @@ image_richcompare(const ImagingObject *self, const PyObject *other, const int op
38103810 palette_b_data_ptr
38113811 )
38123812 ) {
3813- return op == Py_EQ ? Py_False : Py_True ;
3813+ return Py_NewRef ( op == Py_EQ ? Py_False : Py_True ) ;
38143814 }
38153815 }
38163816
3817- if (_compare_pixels (
3817+ if (
3818+ _compare_pixels (
38183819 img_a -> mode ,
38193820 img_a -> ysize ,
38203821 img_a -> linesize ,
38213822 (const UINT8 * * )img_a -> image ,
3822- (const UINT8 * * )img_b -> image )
3823+ (const UINT8 * * )img_b -> image
3824+ )
38233825 ) {
3824- return op == Py_EQ ? Py_False : Py_True ;
3826+ return Py_NewRef ( op == Py_EQ ? Py_False : Py_True ) ;
38253827 } else {
3826- return op == Py_EQ ? Py_True : Py_False ;
3828+ return Py_NewRef ( op == Py_EQ ? Py_True : Py_False ) ;
38273829 }
38283830}
38293831
0 commit comments