Skip to content

Python module: segfault on exit when hierarchy iterators are alive #1327

@klayoutmatthias

Description

@klayoutmatthias

This code makes Python / klayout module segfault on exit:

import klayout.db as kdb
ly = kdb.Layout()
cell = ly.create_cell("TOP")
parents = cell.each_parent_cell()

Root cause is the Python finalization code which first deletes the Layout and then the iterator pointing to is.

A simple workaround is to make sure the iterator ("parents") is removed before finalization:

import klayout.db as kdb
ly = kdb.Layout()
cell = ly.create_cell("TOP")
parents = cell.each_parent_cell()
...
parents = None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions