ironpython3 icon indicating copy to clipboard operation
ironpython3 copied to clipboard

What is the class IronPython.Runtime.Types.OldInstance in IronPython3

Open bnuzhouwei opened this issue 1 year ago • 3 comments

In ironpython2:

class Test:
    pass
Test()

return as IronPython.Runtime.Types.OldInstance and it can as Microsoft.Scripting.Runtime.IMembersList, then all membernames can be got, what's the corrensponding class in IronPython3

bnuzhouwei avatar Jan 18 '24 11:01 bnuzhouwei

There is no equivalent class for OldInstance in IronPython 3 since the concept was removed from Python. To get the member names maybe you could try DynamicHelpers.GetPythonType(o).GetMemberNames(DefaultContext.Default, o).

slozier avatar Jan 19 '24 14:01 slozier

So, What is the base type of the following class, so we can detect the return value is a OldInstance instance:

class Test:
    pass
Test()

if(return_value is OldInstance) { // so logic }

bnuzhouwei avatar Jan 22 '24 12:01 bnuzhouwei

There is no common type. Test() is of type Test. The class definition is the same if you had written the following in IronPython 2:

class Test(object): pass

slozier avatar Jan 22 '24 15:01 slozier