IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 350 forks source link

Debug.Assert: access protected property from user type object #648

Open ironpythonbot opened 9 years ago

ironpythonbot commented 9 years ago

namespace NS {
public class C {
protected static int property {
get { return 1; }
set { }
}
}
}

import clr
clr.AddReference("c")
from NS import *
class D(C): pass
d = D()
d.property

at UserTypeOps.MakeSlotAccess(CodeContext context, StandardRule ` 1 rule, PythonTypeSlot dts, Expression body, Variable tmp, Type userType)  D:\merlin1\ Main\Languages\IronPython\IronPython\Runtime\Operations\UserTypeOps.cs(797)
at UserTypeOps.MakeGetMemberRule(CodeContext context, GetMemberAction action, Object[] args)  D:\merlin1\Main\Languages\IronPython\IronPython\Runtime\Operat ions\UserTypeOps.cs(435)
at UserTypeOps.GetRuleHelper(DynamicAction action, CodeContext context, Object[] args)  D:\merlin1\Main\Languages\IronPython\IronPython\Runtime\Operat ions\UserTypeOps.cs(90)
at C_1.GetRule(DynamicAction , CodeContext , Object[] )

We now throw: SystemError: Operation is not valid due to the current state of the object.

Operation is not valid due to the current state of the object. at Microsoft.Scripting.Actions.PropertyTracker.GetBoundError(ActionBinder binder, Expression instance) in c:\Product\4\Merlin\Main\Runtime\Microsoft.Scripting\A ctions\PropertyTracker.cs:line 136 at Microsoft.Scripting.Actions.BoundMemberTracker.GetError(ActionBinder binder) in c:\Product\4\Merlin\Main\Runtime\Microsoft.Scripting\Actions\BoundMemberTra cker.cs:line 70 at Microsoft.Scripting.Actions.DefaultBinder.MakeGenericBodyWorker(GetMemberInfo getMemInfo, Type type, MemberTracker tracker, Expression instance) in c:\Produ ct\4\Merlin\Main\Runtime\Microsoft.Scripting\Actions\DefaultBinder.GetMember.c s:line 262 at Microsoft.Scripting.Actions.DefaultBinder.MakeGenericBody(GetMemberInfo getMemInfo, Type type, MemberGroup members, Expression instance) in c:\Product \4\Merlin\Main\Runtime\Microsoft.Scripting\Actions\DefaultBinder.GetMember.cs: line 239 at Microsoft.Scripting.Actions.DefaultBinder.MakeSuccessfulMemberAcce ss(GetMemberInfo getMemInfo, Expression self, Expression propSelf, Type type, MemberGroup members, TrackerTypes memberType) in c:\Product\4\Merlin\Main\Runt ime\Microsoft.Scripting\Actions\DefaultBinder.GetMember.cs:line 204 at Microsoft.Scripting.Actions.DefaultBinder.MakeBodyHelper(GetMemberInfo getMemInfo, Expression self, Expression propSelf, Type type, MemberGroup members) in c:\Product\4\Merlin\Main\Runtime\Microsoft.Scripting\Actions\Defau ltBinder.GetMember.cs:line 183 at Microsoft.Scripting.Actions.DefaultBinder.MakeGetMemberTarget(GetMemberInfo getMemInfo, MetaObject target) in c:\Product\4\Merlin\Main\Runtime\Microsoft.S cripting\Actions\DefaultBinder.GetMember.cs:line 168 at Microsoft.Scripting.Actions.DefaultBinder.GetMember(String name, MetaObject target, Expression codeContext, Boolean isNoThrow) in c:\Product\4\Merlin\Main \Runtime\Microsoft.Scripting\Actions\DefaultBinder.GetMember.cs:line 94 at IronPython.Runtime.Binding.GetMemberBinder.Fallback(MetaObject[] args, MetaObject onBindingError) in c:\Product\4\Merlin\Main\Languages\IronPython\Ir onPython\Runtime\Binding\GetMemberBinder.cs:line 105 at System.Scripting.Actions.StandardAction.Fallback(MetaObject[] args) at IronPython.Runtime.Binding.MetaUserObject.Fallback(GetMemberAction action, MetaObject[] args) in c:\Product\4\Merlin\Main\Languages\IronPython\IronPython \Runtime\Binding\MetaUserObject.cs:line 295 at IronPython.Runtime.Binding.MetaUserObject.GetMember(GetMemberAction action, MetaObject[] args) in c:\Product\4\Merlin\Main\Languages\IronPython\IronPython \Runtime\Binding\MetaUserObject.Members.cs:line 78 at System.Scripting.Actions.GetMemberAction.Bind(MetaObject[] args) at System.Scripting.Actions.MetaAction.Bind[T](Object[] args) at System.Scripting.Actions.CallSite 1.CreateNewRule(Rule 1 originalMonomorphicRule, Object[] args) at System.Scripting.Actions.CallSite ` 1.UpdateAndExecute(Object[] args) at System.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at $18$8.$18(Closure , Scope , LanguageContext ) in :line 1 at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope) in c:\Product\4\Merlin\Main\Runtime\Microsoft.Scripting\Run time\OptimizedScriptCode.cs:line 79 at Microsoft.Scripting.ScriptCode.Run(Scope scope) in c:\Product\4\Merlin\Main\Ru ntime\Microsoft.Scripting\Runtime\ScriptCode.cs:line 80 at IronPython.Hosting.PythonCommandLine.cDisplayClass1.b0() in c:\Product\4\M erlin\Main\Languages\IronPython\IronPython\Hosting\PythonCommandLine.cs:line 389SystemError: Operation is not valid due to the current state of the object.

Work Item Details

Original CodePlex Issue: Issue 23934 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Jul 28, 2009 at 12:12 AM Reported by: dfugate Updated on: Feb 22, 2013 at 2:12 AM Updated by: jdhardy Custom value: Reported internally at Microsoft. Test: test_accessibility.py CreatedDate: 1/23/2008 NewInternalID: 409756 OldInternalID: 370438 AreaPath: IronPython

Plaintext Attachments

CodePlex Issue #23934 Plain Text Attachments

ironpythonbot commented 9 years ago

On 2011-01-30 03:57:48 UTC, rjnienaber commented:

The repro code seems to work in 2.6.2 and 2.7b1 on .NET Version: 4.0.30319.1 ipy26 testcase-23934.py

1 ipy27 testcase-23934.py

1

Though the repro code no longer throws an error, I'm not sure what the visibility of the property method should be in terms of CPython semantics.