Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

UnboundName on invoking member for DynamicObject #1128

Open
ironpythonbot opened this issue Dec 9, 2014 · 1 comment
Open

UnboundName on invoking member for DynamicObject #1128

ironpythonbot opened this issue Dec 9, 2014 · 1 comment

Comments

@ironpythonbot
Copy link

Using IronPython 2.7.4 (nuget)

I create a very simple class derived from DynamicObject and set the breakpoint
in TryInvokeMember

public class TestProxy : DynamicObject

{
    public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
    {
        return base.TryInvokeMember(binder, args, out result);
    }
}

I create a script scope and do scope.SetVariable("test", new TestProxy());

Then I execute the string test.Something() and expected to hit the breakpoint.
However it seems that IronPython considers Something is an attribute and call
TryGetMember. If test is a regular C# object, everything works as usual so it
seems to have difficulty with DynamicObject.

As I have been using DynamicObject to create proxies, I cannot use it in a
hosted ironpython session...

Work Item Details

Original CodePlex Issue: Issue 35679
Status: Proposed
Reason Closed: Unassigned
Assigned to: Unassigned
Reported on: Nov 13 at 4:07 PM
Reported by: domtop
Updated on: Nov 14 at 12:57 PM
Updated by: MarkusSchaber

@ironpythonbot
Copy link
Author

On 2014-11-14 20:57:20 UTC, MarkusSchaber commented:

As far as I know, IronPython always uses TryGetMember, and then tries to invoke what it gets there. This is according to the python semantics, where member access and calling are two separate steps.

Maybe you can appropriately override TryGetMember to support your use case?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants