René's URL Explorer Experiment


Title: gh-123290: curses: fix reference leaks in error-branches and cleanup module's initialization by picnixz · Pull Request #123910 · python/cpython · GitHub

Open Graph Title: gh-123290: curses: fix reference leaks in error-branches and cleanup module's initialization by picnixz · Pull Request #123910 · python/cpython

X Title: gh-123290: curses: fix reference leaks in error-branches and cleanup module's initialization by picnixz · Pull Request #123910 · python/cpython

Description: In this PR, we prepare the cursesmodule for #123630 and clean-up some bits. To that end, we: ensure that error branches correctly free resources (even if the error is usually "critical", in the sense that the interpreter would exit after reporting it). protect macros against dangling else using do { ... } while (0) constructions. use upper-case names for global variables; this helps the readability of the module. There are some un-necessary PyObject * casts that will be removed if I were to move from a static type to a heap type, so I won't do it now. Now I have an important question. There is a global variable named ModDict which is set to the module's dict upon initialization. It is then used in initscr() to add other constants. However, AFACIT, this variable is only used as a convenience to avoid re-querying the module's dict, right? Or is there some deeper meaning where I must use a global variable to store tha module's dict? cc @vstinner @encukou Issue: gh-123290

Open Graph Description: In this PR, we prepare the cursesmodule for #123630 and clean-up some bits. To that end, we: ensure that error branches correctly free resources (even if the error is usually "critical",...

X Description: In this PR, we prepare the cursesmodule for #123630 and clean-up some bits. To that end, we: ensure that error branches correctly free resources (even if the error is usually "critical&am...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:af7effed-9107-bd26-9a5a-4f4ad3e3b818
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8A94:3B6B85:1862998:2028267:6B06753C
html-safe-nonce93d9316f710a62cb4ff6c0d75010b65a61d1417d1431bc9aca9d71bdeeebe2cb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTk0OjNCNkI4NToxODYyOTk4OjIwMjgyNjc6NkIwNjc1M0MiLCJ2aXNpdG9yX2lkIjoiMzAzMDA5MzU2MTE3ODY1Nzg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7f20b6c5c05c9d9cb5caf20b9538e1464c10d8195484237710415d5748cfee30
hovercard-subject-tagpull_request:2063557302
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/123910/files
twitter:imagehttps://avatars.githubusercontent.com/u/10796600?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/10796600?s=400&v=4
og:image:altIn this PR, we prepare the cursesmodule for #123630 and clean-up some bits. To that end, we: ensure that error branches correctly free resources (even if the error is usually "critical",...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a
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
release6d3909414814ff86ce7da4c51a0f4918a13fb41b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/123910/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F123910%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F123910%2Ffiles
Sign uphttps://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/123910/files
Reloadhttps://github.com/python/cpython/pull/123910/files
Reloadhttps://github.com/python/cpython/pull/123910/files
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
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
picnixzhttps://github.com/picnixz
python:mainhttps://github.com/python/cpython/tree/main
picnixz:curses/consistent-cleanup-123630https://github.com/picnixz/cpython/tree/curses/consistent-cleanup-123630
Conversation 29 https://github.com/python/cpython/pull/123910
Commits 12 https://github.com/python/cpython/pull/123910/commits
Checks 0 https://github.com/python/cpython/pull/123910/checks
Files changed https://github.com/python/cpython/pull/123910/files
Please reload this pagehttps://github.com/python/cpython/pull/123910/files
gh-123290: curses: fix reference leaks in error-branches and cleanup module's initialization https://github.com/python/cpython/pull/123910/files#top
Show all changes 12 commits https://github.com/python/cpython/pull/123910/files
3ce06f4 Fix reference leaks in the error-branches. picnixz Aug 24, 2024 https://github.com/python/cpython/pull/123910/commits/3ce06f4ca260d1a66960cb9bf3861e9f5a077ca3
81bcde8 protect macros expansions using `do { ... } while (0)` constructions picnixz Sep 10, 2024 https://github.com/python/cpython/pull/123910/commits/81bcde89122edb4c0a914ba7306ca51edaabcffd
848cc3e use uppercase global flags picnixz Sep 10, 2024 https://github.com/python/cpython/pull/123910/commits/848cc3e8f61a32f68330508a76fa082a9aa50676
ea3fd8d cosmetic changes picnixz Sep 10, 2024 https://github.com/python/cpython/pull/123910/commits/ea3fd8da7a8b6066b7f9e2289c74d95c19e6923c
557a53c improve `SetDictInt` macro picnixz Sep 10, 2024 https://github.com/python/cpython/pull/123910/commits/557a53c8eba83b4c3a379e2faa39b448dfc45dcd
a92fc1f undef utililty macros picnixz Sep 10, 2024 https://github.com/python/cpython/pull/123910/commits/a92fc1fb8094356bdc4c49491cb9eb7c84b14e95
9ce0289 improve macro usage picnixz Sep 10, 2024 https://github.com/python/cpython/pull/123910/commits/9ce028946f6e4f03c5ee603a36a0b7b25587ae43
fd7372a update globals picnixz Sep 10, 2024 https://github.com/python/cpython/pull/123910/commits/fd7372aaaa58fbf2e299122446c4c6571314b5c8
384716d address Victor's review picnixz Sep 11, 2024 https://github.com/python/cpython/pull/123910/commits/384716d2ca3a8d057d6dcf0fa0a45b15a61e88a7
24f47a1 fix compilation if `Py_GIL_DISABLED` is defined picnixz Sep 11, 2024 https://github.com/python/cpython/pull/123910/commits/24f47a11622d30055ee9a1de248ff50f6dbe5f30
4a1003c use a local macro picnixz Sep 11, 2024 https://github.com/python/cpython/pull/123910/commits/4a1003c745cd8c2fe572c949d940a677fda05661
356b00c remove unused undefs picnixz Sep 11, 2024 https://github.com/python/cpython/pull/123910/commits/356b00c15b27294a7d45b96711f58c88dba5ee0f
Clear filters https://github.com/python/cpython/pull/123910/files
Please reload this pagehttps://github.com/python/cpython/pull/123910/files
Please reload this pagehttps://github.com/python/cpython/pull/123910/files
_cursesmodule.c https://github.com/python/cpython/pull/123910/files#diff-f77a12c8531c26a47799058e7b02fd9b43753a458b5ed1cefc6693685aa098ce
globals-to-fix.tsv https://github.com/python/cpython/pull/123910/files#diff-8d1e9a0d5771dfc3a628047509e2d4a1027327bd89392e5a3ec5fbd3d08cfa19
Please reload this pagehttps://github.com/python/cpython/pull/123910/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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.