Issue1264

classification
Title: 'is not' test exhibits incorrect behaviour when wrapping Java objects
Type: Severity: normal
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: MrMeanie, cgroves, fwierzbicki
Priority: high Keywords: patch

Created on 2009-02-21.22:35:47 by MrMeanie, last changed 2009-04-05.18:37:08 by fwierzbicki.

Files
File name Uploaded Description Edit Remove
identity_test_20090221.zip MrMeanie, 2009-02-21.22:35:47 Unit test
identity_fix_20090221.patch MrMeanie, 2009-02-21.23:00:14
identity_test_20090221_v2.zip MrMeanie, 2009-02-21.23:05:40 Unit test
Messages
msg4151 (view) Author: Geoffrey French (MrMeanie) Date: 2009-02-21.22:35:46
The 'is not' test exhibits incorrect behavior when wrapping Java objects.

Please find attached a zip containing a java source file to compile, and
a python unittest to run.

It checks that the identity comparison functions work as they should.
The particular issue that is uncovered here occurs when:

The test works by creating a IdentityTestObject().
Its 'getThis()' method is invoked, which returns itself.
This results in this object getting wrapped twice by Jython; the
underlying Java object is identical, but the wrappers are different.

The 'is' check works fine, in that it results in True.
However, the 'is not' check fails, also resulting in True.
msg4152 (view) Author: Geoffrey French (MrMeanie) Date: 2009-02-21.23:00:14
Please find attached a patch that modifies the PyObject._isnot() method.
Provided that my understanding of the usage of the 'javaProxy' field is
correct, this patch should be fine.

(My understanding is, that javaProxy is *only* non-null when the object
is wrapping a Java object; any Python object
(int/bool/float/list/dict/etc) has javaProxy set to null.
msg4153 (view) Author: Geoffrey French (MrMeanie) Date: 2009-02-21.23:05:40
The 'javaProxy' field can also be set when a python object derives from
a Java object.

The unit test has been expanded to check this. Please find attached.
msg4448 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-04-05.18:37:08
Applied to r6165 with the tests altered so that they get compiled and
picked up by regression testing.  Thanks Geoffrey!
History
Date User Action Args
2009-04-05 18:37:09fwierzbickisetstatus: open -> closed
resolution: fixed
messages: + msg4448
2009-03-14 14:24:28fwierzbickisetpriority: high
assignee: fwierzbicki
2009-02-24 15:31:50fwierzbickisetnosy: + fwierzbicki
2009-02-23 12:13:09cgrovessetnosy: + cgroves
2009-02-21 23:05:40MrMeaniesetfiles: + identity_test_20090221_v2.zip
messages: + msg4153
2009-02-21 23:00:15MrMeaniesetfiles: + identity_fix_20090221.patch
keywords: + patch
messages: + msg4152
2009-02-21 22:35:47MrMeaniecreate