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

Applying for-in structure in 'yield from' crashes ironpython. #1616

Open xiaxinmeng opened 1 year ago

xiaxinmeng commented 1 year ago

See the following 'test.py', we define a function, in which we use yield from to handle a for-in structure. Ironpython(main branch) crashes. This works well on CPython 3.9.0

test.py

def test(b):
    obj = range(10)
    yield from (b for x in range(10))

Error message:

>>'ironpython/ironpython3/bin/Debug/net6.0/ipy' test.py
.........
   at Microsoft.Scripting.Hosting.Shell.CommandLine.Run(ScriptEngine engine, IConsole console, ConsoleOptions options) in /home/xxm/Desktop/IFuzzer/experiment_on_different_interpreter/ironpython/ironpython3/Src/DLR/Src/Microsoft.Dynamic/Hosting/Shell/CommandLine.cs:line 100
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.RunCommandLine() in /home/xxm/Desktop/IFuzzer/experiment_on_different_interpreter/ironpython/ironpython3/Src/DLR/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHost.cs:line 386
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.ExecuteInternal() in /home/xxm/Desktop/IFuzzer/experiment_on_different_interpreter/ironpython/ironpython3/Src/DLR/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHost.cs:line 321
   at PythonConsoleHost.ExecuteInternal() in /home/xxm/Desktop/IFuzzer/experiment_on_different_interpreter/ironpython/ironpython3/Src/IronPythonConsole/Console.cs:line 165
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Execute() in /home/xxm/Desktop/IFuzzer/experiment_on_different_interpreter/ironpython/ironpython3/Src/DLR/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHost.cs:line 299
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Run(String[] args) in /home/xxm/Desktop/IFuzzer/experiment_on_different_interpreter/ironpython/ironpython3/Src/DLR/Src/Microsoft.Dynamic/Hosting/Shell/ConsoleHost.cs:line 197
   at PythonConsoleHost.Main(String[] args) in /home/xxm/Desktop/IFuzzer/experiment_on_different_interpreter/ironpython/ironpython3/Src/IronPythonConsole/Console.cs:line 199
Aborted (core dumped)

System info: ironpython3-debug(main branch):IronPython 3.4.0b1 DEBUG (3.4.0.0010)[.NETCoreApp,Version=v6.0 on .NET 6.0.11 (64-bit)] on linux operating system: Ubuntu 18.04.6 LTS

slozier commented 1 year ago

Thanks! Seems to hit an assertion error in debug mode.