Issue1333

classification
Title: attribute wrongly deemed 'write-only' if setter comes from an interface
Type: Severity: major
Components: Core Versions: 25rc4
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pjenvey Nosy List: cgroves, doublep, pjenvey
Priority: urgent Keywords: patch

Created on 2009-04-29.13:53:17 by doublep, last changed 2009-06-04.01:41:11 by pjenvey.

Files
File name Uploaded Description Edit Remove
half_bean_fix.diff pjenvey, 2009-05-31.05:13:32
Messages
msg4618 (view) Author: (doublep) Date: 2009-04-29.13:53:16
Java code:

public interface Foo
{
    void setFoo (int foo);
}

public class FooImpl implements Foo
{
    private int  foo;


    public int getFoo ()
    {
        return foo;
    }

    public void setFoo (int foo)
    {
        this.foo = foo;
    }
}

Python code:

import FooImpl

x = FooImpl ()
x.foo

Result:

Exception in thread "main" Traceback (most recent call last):
  File "test.py", line 4, in <module>
    x.foo

If the getter comes from an interface it seems to work.  I.e. you can
assign to the attribute.

Tested with 2.5b4.
msg4619 (view) Author: (doublep) Date: 2009-04-29.13:54:15
The stack trace is:

Exception in thread "main" Traceback (most recent call last):
  File "test.py", line 4, in <module>
    x.foo
AttributeError: write-only attr: foo

Forgot to copy the actual exception line.
msg4739 (view) Author: (doublep) Date: 2009-05-28.15:37:41
Ping
msg4767 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-31.05:12:30
Here's a potential fix. Charlie, can you please review this?
msg4785 (view) Author: Charlie Groves (cgroves) Date: 2009-06-03.07:39:43
Looks good to me.  Commit away!
msg4792 (view) Author: Philip Jenvey (pjenvey) Date: 2009-06-04.01:41:11
fixed in r6444, thanks
History
Date User Action Args
2009-06-04 01:41:11pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg4792
2009-06-04 01:37:21pjenveysetassignee: cgroves -> pjenvey
2009-06-03 07:39:43cgrovessetmessages: + msg4785
2009-05-31 05:14:27pjenveysetfiles: + half_bean_fix.diff
nosy: + pjenvey
messages: + msg4767
priority: urgent
assignee: cgroves
keywords: + patch
2009-05-28 20:18:36pjenveysetnosy: + cgroves
2009-05-28 15:37:41doublepsetmessages: + msg4739
2009-04-29 13:54:15doublepsetmessages: + msg4619
2009-04-29 13:53:17doublepcreate