Skip to content

Subclassed Symbols that define __getitem__ break DenseMatrix #485

Open
@bocklund

Description

@bocklund

Here's a self-contained test

from symengine import Symbol, DenseMatrix
class MySymbol(Symbol):
    def __getitem__(self, x):
        pass
x = Symbol("x")
y = MySymbol("y")
DenseMatrix([x])  # works fine
DenseMatrix([y])  # SIGSEGV

In PyCalphad (pycalphad/pycalphad#547), we have something where __getitem__ returns, effectively, a new MySymbol, and think ends up in some loop where MySymbol keeps getting created and eats all the system memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions