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