-
Notifications
You must be signed in to change notification settings - Fork 304
Description
Prerequisites
.net 8 and .net 9 application with embedded IronPython3
The issue tracker is used to report bugs and request new features, NOT to ask questions.
Questions should be posted in Discussions or to the users mailing list which can be accessed at
https://ironpython.groups.io/g/users.
- Are you running the latest version?
- Are you reporting to the correct repository?
- Did you perform a cursory search?
Description
I have an application with embedded IronPython. When I build it with .net 8 it works fine. However, if I build it with .net 9 the input() function will throw an exception:
System.ArgumentException: Type doesn't have a method with a given name and signature. (Parameter 'type')
Here is the call stack:
at Microsoft.Scripting.Utils.ContractUtils.Requires(Boolean precondition, String paramName, String message)
at Microsoft.Scripting.Generation.ILGen.EmitCall(Type type, String name, Type[] paramTypes)
at IronPython.Runtime.Types.NewTypeMaker.ImplementCTDOverride(MethodInfo m)
at IronPython.Runtime.Types.NewTypeMaker.ImplementCustomTypeDescriptor()
at IronPython.Runtime.Types.NewTypeMaker.ImplementPythonObject()
at IronPython.Runtime.Types.NewTypeMaker.ImplementType()
at IronPython.Runtime.Types.NewTypeMaker.CreateNewType()
at IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass24_0.b__0()
at Microsoft.Scripting.Utils.Publisher2.GetOrCreateValue(TKey key, Func
1 create)
at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String typeName, PythonTuple bases)
at IronPython.Runtime.Types.PythonType.InitializeUserType(CodeContext context, String name, PythonTuple bases, PythonDictionary vars, String selfNames)
at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, String name, PythonTuple bases, PythonDictionary dict, String selfNames)
at IronPython.Runtime.Types.PythonType.new(CodeContext context, PythonType cls, String name, PythonTuple bases, PythonDictionary dict, String selfNames)
at IronPython.Runtime.Operations.PythonOps.MakeClass(FunctionCode funcCode, Func2 body, CodeContext parentContext, String name, PythonTuple bases, PythonDictionary keywords, String selfNames) at Microsoft.Scripting.Interpreter.FuncCallInstruction
8.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
at IronPython.Runtime.ZipImportModule.zipimporter.load_module(CodeContext context, String fullname)
at Microsoft.Scripting.Interpreter.FuncCallInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in /_/src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 376 at Microsoft.Scripting.Interpreter.FuncCallInstruction
6.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at IronPython.Runtime.PythonContext.Call(CodeContext context, Object func, Object arg0)
at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter(CodeContext context, Object importer, String fullName, PythonList path, Object& ret)
at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, PythonList path, Func5 defaultLoader) at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, PythonList path) at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name) at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level) at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level) at Microsoft.Scripting.Interpreter.FuncCallInstruction
7.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run8[T0,T1,T2,T3,T4,T5,T6,T7,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
at IronPython.Runtime.Operations.PythonOps.ImportTop(CodeContext context, String fullName, Int32 level)
at Microsoft.Scripting.Interpreter.FuncCallInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at IronPython.Compiler.PythonScriptCode.Run(Scope scope) at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope) at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope) at IronPython.Runtime.ZipImportModule.zipimporter.load_module(CodeContext context, String fullname) at Microsoft.Scripting.Interpreter.FuncCallInstruction
4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in //src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 418
at Microsoft.Scripting.Interpreter.FuncCallInstruction6.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at IronPython.Runtime.PythonContext.Call(CodeContext context, Object func, Object arg0) at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter(CodeContext context, Object importer, String fullName, PythonList path, Object& ret) at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, PythonList path, Func
5 defaultLoader)
at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, PythonList path)
at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)
at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
at IronPython.Runtime.PythonContext.EnsureEncodings()
at IronPython.Runtime.Operations.PythonOps.LookupEncoding(CodeContext context, String encoding)
at IronPython.Modules.PythonIOModule.TextIOWrapper.GetDecoder(CodeContext context)
at IronPython.Modules.PythonIOModule.TextIOWrapper.readline(CodeContext context, Int32 limit)
at Microsoft.Scripting.Interpreter.FuncCallInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in /_/src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 418 at IronPython.Runtime.PythonContext.CallSplat(CodeContext context, Object func, Object[] args) at IronPython.Runtime.Operations.PythonCalls.Call(CodeContext context, Object func, Object[] args) at IronPython.Runtime.Operations.PythonOps.Invoke(CodeContext context, Object target, String name, Object[] args) at IronPython.Runtime.Operations.PythonOps.ReadLine(CodeContext context, Object f) at IronPython.Runtime.Operations.PythonOps.ReadLineFromSrc(CodeContext context, Object src) at IronPython.Modules.Builtin.input(CodeContext context, Object prompt) at Microsoft.Scripting.Interpreter.FuncCallInstruction
3.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in //src/libraries/System.Linq.Expressions/src/System/Dynamic/UpdateDelegates.Generated.cs:line 418
at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Compiler.PythonScriptCode.Run(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
at Microsoft.Scripting.SourceUnit.Execute(Scope scope)
at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
at Microsoft.Scripting.Hosting.ScriptEngine.Execute(String expression, ScriptScope scope)
at LogicCircuit.IronPythonConsole.<>c__DisplayClass26_0.g__run|0() in C:\Projects\LogicCircuit\LogicCircuit\master\Sources\LogicCircuit\Dialog\IronPythonConsole.xaml.cs:line 166
[Description of the bug or feature]
Steps to Reproduce
I've actually build a small project to repro this. please see the attached.
- Build the provided solution
- with default .net 8 it should work.
- Change TargetFramework to .net 9
- Rebuild and run.
Expected behavior:
[What you expected to happen]
Expecting the program to work without exceptions.
Actual behavior:
throws
- .NET platform used (choice from: .NET, .NET Core, .NET Framework, Mono, Unity, Xamarin),
- Version of the .NET platform used,
- Operating system used: win 10
- Value of
sys.version
, from imported modulesys
.