René's URL Explorer Experiment


Title: gh-90092: Support multiple terminals in the curses module by serhiy-storchaka · Pull Request #151748 · python/cpython · GitHub

Open Graph Title: gh-90092: Support multiple terminals in the curses module by serhiy-storchaka · Pull Request #151748 · python/cpython

X Title: gh-90092: Support multiple terminals in the curses module by serhiy-storchaka · Pull Request #151748 · python/cpython

Description: Add the X/Open Curses SCREEN API for driving more than one terminal: curses.newterm() and curses.set_term(), plus the ncurses extension curses.new_prescr(). A new screen object wraps the C SCREEN and exposes the terminal's standard window as screen.stdscr. Each window keeps a reference to its screen (like a subwindow does to its parent window), so a screen is freed automatically once it and all of its windows are unreferenced. delscreen() is deferred to the screen object's deallocation rather than its tp_clear, so it runs only after the screen's windows — and any panels built on them — are gone. The ncurses use_screen()/use_window() locking helpers are exposed as the screen.use() and window.use() methods, forwarding *args and **kwargs to the callable. ScreenTests now run in-process over pseudo-terminals instead of subprocesses, and TestCurses drives a newterm() screen, so the new API is exercised without needing a second real terminal. 🤖 Generated with Claude Code Issue: gh-90092

Open Graph Description: Add the X/Open Curses SCREEN API for driving more than one terminal: curses.newterm() and curses.set_term(), plus the ncurses extension curses.new_prescr(). A new screen object wraps the C SCREEN a...

X Description: Add the X/Open Curses SCREEN API for driving more than one terminal: curses.newterm() and curses.set_term(), plus the ncurses extension curses.new_prescr(). A new screen object wraps the C SCREEN a...

Opengraph URL: https://github.com/python/cpython/pull/151748

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ddefec3b-7356-d239-a6cf-b07c6b9c7971
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBBF8:3860CA:838355:B241D9:6A55AA91
html-safe-nonce89f68b8f459fda7d5548b089cc2938fc0a21da16eea2123e44411ff563a3d7f8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkY4OjM4NjBDQTo4MzgzNTU6QjI0MUQ5OjZBNTVBQTkxIiwidmlzaXRvcl9pZCI6IjUwMTk4MTQ2Nzc2Mjg0MzA5OTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac9a34002671f9090b1178d6e09eb624c54fce97645cca349419f50a9795dd2281
hovercard-subject-tagpull_request:3900524730
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/151748/files
twitter:imagehttps://avatars.githubusercontent.com/u/3659035?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3659035?s=400&v=4
og:image:altAdd the X/Open Curses SCREEN API for driving more than one terminal: curses.newterm() and curses.set_term(), plus the ncurses extension curses.new_prescr(). A new screen object wraps the C SCREEN a...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release653fccf1e27344851c0d3de3fa6faa526197f072
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/151748/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F151748%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F151748%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/151748/files
Reloadhttps://github.com/python/cpython/pull/151748/files
Reloadhttps://github.com/python/cpython/pull/151748/files
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
serhiy-storchakahttps://github.com/serhiy-storchaka
python:mainhttps://github.com/python/cpython/tree/main
serhiy-storchaka:curses-newtermhttps://github.com/serhiy-storchaka/cpython/tree/curses-newterm
Conversation 8 https://github.com/python/cpython/pull/151748
Commits 10 https://github.com/python/cpython/pull/151748/commits
Checks 53 https://github.com/python/cpython/pull/151748/checks
Files changed https://github.com/python/cpython/pull/151748/files
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
gh-90092: Support multiple terminals in the curses module https://github.com/python/cpython/pull/151748/files#top
Show all changes 10 commits https://github.com/python/cpython/pull/151748/files
0028058 gh-90092: Support multiple terminals in the curses module serhiy-storchaka Jun 19, 2026 https://github.com/python/cpython/pull/151748/commits/00280581e4423f77e01ca23d471783cde4a7dfbc
d27487e Drain the pty masters in ScreenTests and release the GIL in endwin() serhiy-storchaka Jun 19, 2026 https://github.com/python/cpython/pull/151748/commits/d27487e2f39e34b9572c17e2bfdd65a93c0e91c5
6d48237 Drain the pty masters continuously from a background thread serhiy-storchaka Jun 20, 2026 https://github.com/python/cpython/pull/151748/commits/6d4823707cd5642830a61990fd9595612a0c3bc3
228f977 Close the pty master before the slave in ScreenTests serhiy-storchaka Jun 20, 2026 https://github.com/python/cpython/pull/151748/commits/228f9771d6bf52a42bd6273b3215ef5a4c96b8a8
2165c49 Stop the pty reader thread before closing the fds in ScreenTests serhiy-storchaka Jun 20, 2026 https://github.com/python/cpython/pull/151748/commits/2165c4962356540202bcbc0c6a40ab3ee72de854
03f0d8c Collect each test's screen reference cycle in TestCurses serhiy-storchaka Jun 20, 2026 https://github.com/python/cpython/pull/151748/commits/03f0d8c9835e796f5108f524aee9f21296d79c87
6fb6465 Add screen.close() to break the screen/window reference cycle serhiy-storchaka Jun 20, 2026 https://github.com/python/cpython/pull/151748/commits/6fb6465daf6c296defcfd390a07e2dc0552e51b8
b3792c3 Clean up the panel created by test_userptr_segfault serhiy-storchaka Jun 20, 2026 https://github.com/python/cpython/pull/151748/commits/b3792c3e7e3b6ced28a8c2072ab9cadfbdad5867
fd73570 Merge branch 'main' into curses-newterm serhiy-storchaka Jun 24, 2026 https://github.com/python/cpython/pull/151748/commits/fd73570524770cc097816de889dbe2745b24d496
86d808e gh-90092: Fix :meth: reference target in whatsnew serhiy-storchaka Jun 24, 2026 https://github.com/python/cpython/pull/151748/commits/86d808eb11dc7fe35a0511df7ac625bd4d8732d0
Clear filters https://github.com/python/cpython/pull/151748/files
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
curses.rst https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
3.16.rst https://github.com/python/cpython/pull/151748/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
py_curses.h https://github.com/python/cpython/pull/151748/files#diff-20c11bc93fa13e7529837bd28f4f11045ed1d68df5e532fe7695d3fa720c0660
__init__.py https://github.com/python/cpython/pull/151748/files#diff-800da5b76b0c410fdb8f4e1dce330e091b1869993eaeff8800ad0e467beb3761
test_curses.py https://github.com/python/cpython/pull/151748/files#diff-d8a49e57c7f50f48b6ae331ca0dcd3634ed1b1d35d10601c57b15ba405fbb765
2026-06-19-12-19-30.gh-issue-90092.yBVc0C.rst https://github.com/python/cpython/pull/151748/files#diff-01aaeacedb6d6f2eba0551d6a4bc1f24ae4d951fa482c4925c9a08f4e2a80eb1
_cursesmodule.c https://github.com/python/cpython/pull/151748/files#diff-f77a12c8531c26a47799058e7b02fd9b43753a458b5ed1cefc6693685aa098ce
_cursesmodule.c.h https://github.com/python/cpython/pull/151748/files#diff-3712cb338691dd25b68632e5dae69b904aff02ecc7348a2c792d4c0acf007d8a
configure https://github.com/python/cpython/pull/151748/files#diff-90d08e583c4c9c6f391b2ae90f819f600a6326928ea9512c9e0c6d98e9f29ac2
configure.ac https://github.com/python/cpython/pull/151748/files#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
pyconfig.h.in https://github.com/python/cpython/pull/151748/files#diff-f67052280dd3a53f0e713339632a8c10bc2e420e24a70852d83aeb50d495835f
Doc/library/curses.rsthttps://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
View file https://github.com/serhiy-storchaka/cpython/blob/86d808eb11dc7fe35a0511df7ac625bd4d8732d0/Doc/library/curses.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/151748/{{ revealButtonHref }}
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
StanFromIrelandhttps://github.com/StanFromIreland
Jun 19, 2026https://github.com/python/cpython/pull/151748/files#r3444550210
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
serhiy-storchakahttps://github.com/serhiy-storchaka
Jun 19, 2026https://github.com/python/cpython/pull/151748/files#r3444670447
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/pull/151748/files#diff-cb5622768373b8c93cc8eee30dfb041108783bb419d9eaf205501989cea0049f
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L116
Doc/whatsnew/3.16.rsthttps://github.com/python/cpython/pull/151748/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
View file https://github.com/serhiy-storchaka/cpython/blob/86d808eb11dc7fe35a0511df7ac625bd4d8732d0/Doc/whatsnew/3.16.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/151748/{{ revealButtonHref }}
https://github.com/python/cpython/pull/151748/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
https://github.com/python/cpython/pull/151748/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
Include/py_curses.hhttps://github.com/python/cpython/pull/151748/files#diff-20c11bc93fa13e7529837bd28f4f11045ed1d68df5e532fe7695d3fa720c0660
View file https://github.com/serhiy-storchaka/cpython/blob/86d808eb11dc7fe35a0511df7ac625bd4d8732d0/Include/py_curses.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/151748/{{ revealButtonHref }}
https://github.com/python/cpython/pull/151748/files#diff-20c11bc93fa13e7529837bd28f4f11045ed1d68df5e532fe7695d3fa720c0660
https://github.com/python/cpython/pull/151748/files#diff-20c11bc93fa13e7529837bd28f4f11045ed1d68df5e532fe7695d3fa720c0660
Lib/curses/__init__.pyhttps://github.com/python/cpython/pull/151748/files#diff-800da5b76b0c410fdb8f4e1dce330e091b1869993eaeff8800ad0e467beb3761
View file https://github.com/serhiy-storchaka/cpython/blob/86d808eb11dc7fe35a0511df7ac625bd4d8732d0/Lib/curses/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/151748/{{ revealButtonHref }}
https://github.com/python/cpython/pull/151748/files#diff-800da5b76b0c410fdb8f4e1dce330e091b1869993eaeff8800ad0e467beb3761
https://github.com/python/cpython/pull/151748/files#diff-800da5b76b0c410fdb8f4e1dce330e091b1869993eaeff8800ad0e467beb3761
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
Please reload this pagehttps://github.com/python/cpython/pull/151748/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.