IronLanguages / IronLanguages/ironpython3

Changing __bases__ attribute in issubclass() causes core dumped

Open
#1,608 1 comment 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

In the following example test.py, we define two classes A and B. If we change 'bases' in issubclass, ironpython crashes

test.py:

class A:
    @property
    def __bases__(self):
        return (self,)

class B:
    @property
    def __bases__(self):
        return (A(),)
        
assert issubclass(B(), int) #crash

Error message:

>>'ironpython/ironpython3/bin/Debug/net6.0/ipy' test.py
...
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Microsoft.Scripting.Runtime.Scope)
   at IronPython.Compiler.RuntimeScriptCode.Run(Microsoft.Scripting.Runtime.Scope)
   at IronPython.Hosting.PythonCommandLine.RunFileWorker(System.String)
   at IronPython.Hosting.PythonCommandLine.RunFile(System.String)
   at Microsoft.Scripting.Hosting.Shell.CommandLine.Run()
   at IronPython.Hosting.PythonCommandLine.Run()
   at Microsoft.Scripting.Hosting.Shell.CommandLine.Run(Microsoft.Scripting.Hosting.ScriptEngine, Microsoft.Scripting.Hosting.Shell.IConsole, Microsoft.Scripting.Hosting.Shell.ConsoleOptions)
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.RunCommandLine()
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.ExecuteInternal()
   at PythonConsoleHost.ExecuteInternal()
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Execute()
   at Microsoft.Scripting.Hosting.Shell.ConsoleHost.Run(System.String[])
   at PythonConsoleHost.Main(System.String[])
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

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

Start with the test.py reproducer and run it using the IronPython command shown in the report. Trace the issubclass() handling for classes exposing bases; done means this input no longer aborts with a core dump and has regression coverage.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.