8000 bpo-44172: Keep reference to original window in curses subwindow objects by michaelforney · Pull Request #26226 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44172: Keep reference to original window in curses subwindow objects #26226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 4, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a test.
  • Loading branch information
serhiy-storchaka committed Apr 12, 2025
commit b04218b4b15c7b59f2c6af251b5ed3d0c8bae785
11 changes: 10 additions & 1 deletion Lib/test/test_curses.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from unittest.mock import MagicMock

from test.support import (requires, verbose, SaveSignals, cpython_only,
check_disallow_instantiation, MISSING_C_DOCSTRINGS)
check_disallow_instantiation, MISSING_C_DOCSTRINGS,
gc_collect)
from test.support.import_helper import import_module

# Optionally test curses module. This currently requires that the
Expand Down Expand Up @@ -181,6 +182,14 @@ def test_create_windows(self):
self.assertEqual(win3.getparyx(), (2, 1))
self.assertEqual(win3.getmaxyx(), (6, 11))

def test_subwindows_references(self):
win = curses.newwin(5, 10)
win2 = win.subwin(3, 7)
del win
gc_collect()
del win2
gc_collect()

def test_move_cursor(self):
stdscr = self.stdscr
win = stdscr.subwin(10, 15, 2, 5)
Expand Down
0