Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bnuzhouwei opened this issue Jan 18, 2024 · 3 comments
Open

Comments

@bnuzhouwei
Copy link

bnuzhouwei commented Jan 18, 2024

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

@slozier
Copy link
Contributor

slozier commented Jan 19, 2024

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).

@bnuzhouwei
Copy link
Author

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
}

@slozier
Copy link
Contributor

slozier commented Jan 22, 2024

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

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

No branches or pull requests

2 participants