Author a.badger
Recipients Josiah Ulfers, a.badger, lisroach, twouters
Date 2019-05-08.15:53:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557330830.59.0.310250615257.issue35924@roundup.psfhosted.org>
In-reply-to
Content
I've diagnosed this a bit further and have a workaround for you.  It appears that using addstr() with a string with embedded newlines is a piece of the problem.  If I modify your example program so that we add each line as a separate string instead of adding them as a single string with embedded newlines, we get the ncurses ERR on resize instead of a segfault:

import curses

def main(stdscr):
    y, x = curses.LINES//3, curses.COLS//3  # size is arbitrary
    box = '\n'.join('+'*x for _ in range(y))
    w = stdscr.subwin(y, x+1, y, x) 
    while True: 
        new_box = box[:]
        w.clear()
        for offset, line in enumerate(box.splitlines()):
            w.addstr(offset, 0, line) 
        w.getch()  # not required, just avoids a hot loop

curses.wrapper(main)


I don't see anything in the curses specification that forbids embedded newlines in the string to addstr(), though, so I am still thinking that this is a bug in ncurses.
History
Date User Action Args
2019-05-08 15:53:50a.badgersetrecipients: + a.badger, twouters, lisroach, Josiah Ulfers
2019-05-08 15:53:50a.badgersetmessageid: <1557330830.59.0.310250615257.issue35924@roundup.psfhosted.org>
2019-05-08 15:53:50a.badgerlinkissue35924 messages
2019-05-08 15:53:50a.badgercreate