Message3899

Author pjenvey
Recipients pjenvey
Date 2008-12-10.04:55:01
SpamBayes Score 2.7558634e-08
Marked as misclassified No
Message-id <1228884902.74.0.194324834784.issue1197@psf.upfronthosting.co.za>
In-reply-to
Content
Our binop methods return null to signal the binop "doesn't support the 
operation -- try alternatives". When we expose them as binary ops, those 
nulls are translated into Py.NotImplemented

The binop fast path looks for nulls, the slow path (_binop_rule) uses 
the exposed methods and looks for Py.NotImplemented

PyInstance still does not use exposed annotations, provides binops for 
all ops, and they all return null. This breaks _binop_rule:

Jython 2.5b0+ (trunk:5722:5725M, Dec 9 2008, 16:06:58) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_07
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo: pass
... 
>>> class Bar(object):
... 	def __radd__(self, other):
... 		return 3
... 
>>> print Foo() + Bar()
None

(We at least got a None, instead of null, because it went through the 
exposed version -- which is the Java integration version) 

i.e.
>>> # should return NotImplemented
>>> print types.InstanceType.__add__(Foo(), Bar())
None

We either need to expose PyInstance (a bunch more generated .classes) or 
think of another workaround
History
Date User Action Args
2008-12-10 04:55:03pjenveysetrecipients: + pjenvey
2008-12-10 04:55:02pjenveysetmessageid: <1228884902.74.0.194324834784.issue1197@psf.upfronthosting.co.za>
2008-12-10 04:55:02pjenveylinkissue1197 messages
2008-12-10 04:55:01pjenveycreate