@@ -92,16 +92,17 @@ def __init__(self, p, a, b, h=None):
9292 self .__h = h
9393
9494 def __eq__ (self , other ):
95- """Return True if the curves are identical, False otherwise."""
96- return (
97- isinstance (other , CurveFp )
98- and self .__p == other .__p
99- and self .__a == other .__a
100- and self .__b == other .__b
101- )
95+ if isinstance (other , CurveFp ):
96+ """Return True if the curves are identical, False otherwise."""
97+ return (
98+ self .__p == other .__p
99+ and self .__a == other .__a
100+ and self .__b == other .__b
101+ )
102+ return NotImplemented
102103
103104 def __ne__ (self , other ):
104- return not self . __eq__ ( other )
105+ return not ( self == other )
105106
106107 def __hash__ (self ):
107108 return hash ((self .__p , self .__a , self .__b ))
@@ -188,14 +189,12 @@ def __init__(self, curve, x, y, z, order=None, generator=False):
188189 self .__precompute .append ((doubler .x (), doubler .y ()))
189190
190191 def __getstate__ (self ):
191- state = None
192192 try :
193193 self ._scale_lock .reader_acquire ()
194194 state = self .__dict__ .copy ()
195195 finally :
196196 self ._scale_lock .reader_release ()
197- if state :
198- del state ["_scale_lock" ]
197+ del state ["_scale_lock" ]
199198 return state
200199
201200 def __setstate__ (self , state ):
0 commit comments