IronLanguages / IronLanguages/ironpython3

IronPython crashes when repr() handles too long nest dictionary

Open
#1,261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed
Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

When repr() takes a deep nested dictionary as argument, IronPython crashes.

test.py

x = {}
for i in range(100000):
    x = {1: x}

repr(x)

Crash report

.......
at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) [0x00016] in <252827dbc7924637ba1c8c95b5f54810>:0
at Microsoft.Scripting.Interpreter.LightLambda.Run1<T0_REF, TRet_REF> (T0_REF) [0x0003e] in <252827dbc7924637ba1c8c95b5f54810>:0
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget (Microsoft.Scripting.Runtime.Scope) [0x0006a] in <5cd2739cd27844619789a1aa1ffdb0b0>:0
at IronPython.Compiler.RuntimeScriptCode.Run (Microsoft.Scripting.Runtime.Scope) [0x00000] in <5cd2739cd27844619789a1aa1ffdb0b0>:0
at IronPython.Hosting.PythonCommandLine.RunFileWorker (string) [0x000e5] in <5cd2739cd27844619789a1aa1ffdb0b0>:0
at IronPython.Hosting.PythonCommandLine.RunFile (string) [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,Microsoft.Scripting.Hosting.Shell.IConsole,Microsoft.Scripting.Hosting.Shell.ConsoleOptions) [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 (string[]) [0x0015b] in <252827dbc7924637ba1c8c95b5f54810>:0
at PythonConsoleHost.Main (string[]) [0x00020] in <9cafe2448f474c41b81ba0c1d71815eb>:0
at (wrapper runtime-invoke) .runtime_invoke_int_object (object,intptr,intptr,intptr) [0x0002a] 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reproduction is provided in test.py and builds a dictionary nested 100,000 levels before calling repr(x); start by running it on the stated IronPython and Mono environment. Trace the repr handling using the crash stack as a guide, and consider the issue done when this input no longer crashes and produces the expected representation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.