### Bug description: `window.insnstr(str, n, attr)` sets the window rendition before the write, and when that fails it never releases the `bytes` object it converted its argument to, so every failing call leaks one reference. `addstr()`, `addnstr()` and `insstr()` got that release in GH-145609 (gh-145376); `insnstr()` was missed. A window detached by `screen.close()` makes the rendition call fail: ```python import curses, sys screen = curses.newterm() win = screen.stdscr screen.close() data = b'x' * 40 before = sys.getrefcount(data) for _ in range(100): try: win.insnstr(data, 8, curses.A_BOLD) except curses.error: pass print('insnstr leaked', sys.getrefcount(data) - before, 'references', file=sys.stderr) ``` ``` insnstr leaked 100 references ``` Expected: `insnstr leaked 0 references`. Only `main` is affected: 3.15 has the same omission, but nothing there detaches a window, so the rendition call cannot fail. ### CPython versions tested on: CPython main branch ### Operating systems tested on: Linux <!-- gh-linked-prs --> ### Linked PRs * gh-156954 <!-- /gh-linked-prs -->