IronLanguages / ironpython3

Implementation of Python 3.x for .NET Framework that is built on top of the Dynamic Language Runtime.
Apache License 2.0
2.51k stars 290 forks source link

Transforming a long list cause IronPython crashes #1260

Open xiaxinmeng opened 3 years ago

xiaxinmeng commented 3 years ago

See the following example, we transform the map l into list, and then IronPython crashes.

test.py

import operator

N = 500000
l = [0]

for i in range(N):
    l = map(operator.add, l, [1])

print(list(l))

Crash report:

....... at (wrapper delegate-invoke) .invoke_callvirt_object_Func5<CallSite, CodeContext, object, object, object>_CallSite_CodeContext_object_object(System.Func5<System.Runtime.CompilerServices.CallSite, IronPython.Runtime.CodeContext, object, object, object>,System.Runtime.CompilerServices.CallSite,IronPython.Runtime.CodeContext,object,object) at Microsoft.Scripting.Interpreter.FuncCallInstruction`6[T0,T1,T2,T3,T4,TRet].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in <252827dbc7924637ba1c8c95b5f54810>:0 at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00016] in <252827dbc7924637ba1c8c95b5f54810>:0 at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3) [0x0006d] in <252827dbc7924637ba1c8c95b5f54810>:0 at IronPython.Compiler.Ast.CallExpression+Invoke1Instruction.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00026] in <5cd2739cd27844619789a1aa1ffdb0b0>:0 at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00016] in <252827dbc7924637ba1c8c95b5f54810>:0 at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet] (T0 arg0) [0x0003e] in <252827dbc7924637ba1c8c95b5f54810>:0 at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope scope) [0x0006a] in <5cd2739cd27844619789a1aa1ffdb0b0>:0 at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope scope) [0x00000] in <5cd2739cd27844619789a1aa1ffdb0b0>:0 at IronPython.Hosting.PythonCommandLine.RunFileWorker (System.String fileName) [0x000e5] in <5cd2739cd27844619789a1aa1ffdb0b0>:0 at IronPython.Hosting.PythonCommandLine.RunFile (System.String fileName) [0x0000f] in <5cd2739cd27844619789a1aa1ffdb0b0>:0 at Microsoft.Scripting.Hosting.Shell.CommandLine.Run () [0x0003a] in <252827dbc7924637ba1c8c95b5f54810>:0 at IronPython.Hosting.PythonCommandLine.Run () [0x000d8] in <5cd2739cd27844619789a1aa1ffdb0b0>:0 at Microsoft.Scripting.Hosting.Shell.CommandLine.Run (Microsoft.Scripting.Hosting.ScriptEngine engine, Microsoft.Scripting.Hosting.Shell.IConsole console, Microsoft.Scripting.Hosting.Shell.ConsoleOptions options) [0x0003c] in <252827dbc7924637ba1c8c95b5f54810>:0 at Microsoft.Scripting.Hosting.Shell.ConsoleHost.RunCommandLine () [0x00053] in <252827dbc7924637ba1c8c95b5f54810>:0 at Microsoft.Scripting.Hosting.Shell.ConsoleHost.ExecuteInternal () [0x00051] in <252827dbc7924637ba1c8c95b5f54810>:0 at PythonConsoleHost.ExecuteInternal () [0x00025] in <9cafe2448f474c41b81ba0c1d71815eb>:0 at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Execute () [0x00032] in <252827dbc7924637ba1c8c95b5f54810>:0 at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Run (System.String[] args) [0x0015b] in <252827dbc7924637ba1c8c95b5f54810>:0 at PythonConsoleHost.Main (System.String[] args) [0x00020] in <9cafe2448f474c41b81ba0c1d71815eb>:0

System

IronPython 3.4.0a1 (3.4.0.0001) [.NETFramework,Version=v4.6 on Mono 6.12.0.122 (64-bit)] on linux

slozier commented 3 years ago

This one also crashes CPython (3.9.5).