René's URL Explorer Experiment


Title: bpo-31356: Add context manager to temporarily disable GC by pablogsal · Pull Request #4224 · python/cpython · GitHub

Open Graph Title: bpo-31356: Add context manager to temporarily disable GC by pablogsal · Pull Request #4224 · python/cpython

X Title: bpo-31356: Add context manager to temporarily disable GC by pablogsal · Pull Request #4224 · python/cpython

Description: As discussed in the issue by @serhiy-storchaka , @rhettinger , @ncoghlan and @gpshead this PR implements a context manager that temporarily disables GC and restores it to its previous state. The implementation is done in C, using the GIL as the locking mechanism to evict the thread problems discussed in the issue. The documentation is updated as well as the test suite to take this into account. Please, indicate any change that is needed and I will be more than happy to change it. 😄 https://bugs.python.org/issue31356

Open Graph Description: As discussed in the issue by @serhiy-storchaka , @rhettinger , @ncoghlan and @gpshead this PR implements a context manager that temporarily disables GC and restores it to its previous state. The im...

X Description: As discussed in the issue by @serhiy-storchaka , @rhettinger , @ncoghlan and @gpshead this PR implements a context manager that temporarily disables GC and restores it to its previous state. The im...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:66af68ab-28bf-a8e6-813f-4cdbf89ca54a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC4B8:309E0A:53E172:732DA8:6A50710F
html-safe-nonce4f4187367f24dc8584d0fa72fbee87055c1fce5a4dc10989305f876b7e5b6583
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEI4OjMwOUUwQTo1M0UxNzI6NzMyREE4OjZBNTA3MTBGIiwidmlzaXRvcl9pZCI6IjUzOTgwMTAwMjAwMzcxNjEyMzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac3d642afb049b9d26b35ecb2451b37cab3cb5c2143e719e0ce8c44fe9d2a5874e
hovercard-subject-tagpull_request:150178153
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/4224/files
twitter:imagehttps://avatars.githubusercontent.com/u/11718525?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/11718525?s=400&v=4
og:image:altAs discussed in the issue by @serhiy-storchaka , @rhettinger , @ncoghlan and @gpshead this PR implements a context manager that temporarily disables GC and restores it to its previous state. The im...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb
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
release7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/4224/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F4224%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%2F4224%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/4224/files
Reloadhttps://github.com/python/cpython/pull/4224/files
Reloadhttps://github.com/python/cpython/pull/4224/files
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.6k 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
rhettingerhttps://github.com/rhettinger
python:masterhttps://github.com/python/cpython/tree/master
pablogsal:bpo31356https://github.com/pablogsal/cpython/tree/bpo31356
Conversation 13 https://github.com/python/cpython/pull/4224
Commits 6 https://github.com/python/cpython/pull/4224/commits
Checks 0 https://github.com/python/cpython/pull/4224/checks
Files changed https://github.com/python/cpython/pull/4224/files
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
bpo-31356: Add context manager to temporarily disable GC https://github.com/python/cpython/pull/4224/files#top
Show all changes 6 commits https://github.com/python/cpython/pull/4224/files
2d80d83 Add first version of the context manager to temporarily disable GC pablogsal Nov 2, 2017 https://github.com/python/cpython/pull/4224/commits/2d80d8310a3c9d7b1f121a9f41c5f4266bfb81bc
4c02071 Add News entry pablogsal Nov 2, 2017 https://github.com/python/cpython/pull/4224/commits/4c0207187508e5d597c345155be55462929da87b
da600dd Add new test and fix test style pablogsal Nov 2, 2017 https://github.com/python/cpython/pull/4224/commits/da600dd0327204b76774b37ed701792398c42925
d7b4266 Simplify allocator pablogsal Nov 2, 2017 https://github.com/python/cpython/pull/4224/commits/d7b42666c4d22b1e2d999cc331b9a3e342149f66
0978387 Rename contextmanager to ensure_disabled pablogsal Nov 11, 2017 https://github.com/python/cpython/pull/4224/commits/097838729c8e1d8738d39d4d14f4d141fff46935
00222b4 Emit a warning if another thread is inside gc.ensure_enabled and the … pablogsal Nov 13, 2017 https://github.com/python/cpython/pull/4224/commits/00222b4a6ec6041b3d651b19b501080cf0b8e0f3
Clear filters https://github.com/python/cpython/pull/4224/files
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
gc.rst https://github.com/python/cpython/pull/4224/files#diff-05935c597d9a54198ea38912d661147c8b1a0091df37848a709b599c462098fa
mem.h https://github.com/python/cpython/pull/4224/files#diff-5445a89d16dd9700d90572e201caa96db6a00920b743685b2db99d6a55c17e92
test_gc.py https://github.com/python/cpython/pull/4224/files#diff-9d9e863bd2a456b669ec9600be793699e861340d91d7c417a8a5b5b8cfbd09a7
2017-11-02-00-34-42.bpo-31356.54Lb8U.rst https://github.com/python/cpython/pull/4224/files#diff-b66a3cc1dcec46ec526f3b61d53ef293a696681d23d72ce57cd2e886641b751c
gcmodule.c https://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
Doc/library/gc.rsthttps://github.com/python/cpython/pull/4224/files#diff-05935c597d9a54198ea38912d661147c8b1a0091df37848a709b599c462098fa
View file https://github.com/pablogsal/cpython/blob/00222b4a6ec6041b3d651b19b501080cf0b8e0f3/Doc/library/gc.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/4224/{{ revealButtonHref }}
https://github.com/python/cpython/pull/4224/files#diff-05935c597d9a54198ea38912d661147c8b1a0091df37848a709b599c462098fa
vadmiumhttps://github.com/vadmium
Nov 11, 2017https://github.com/python/cpython/pull/4224/files#r150393428
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
pablogsalhttps://github.com/pablogsal
Nov 11, 2017https://github.com/python/cpython/pull/4224/files#r150393795
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
ncoghlanhttps://github.com/ncoghlan
Nov 12, 2017https://github.com/python/cpython/pull/4224/files#r150397666
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
pablogsalhttps://github.com/pablogsal
Nov 12, 2017https://github.com/python/cpython/pull/4224/files#r150399383
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
pablogsalhttps://github.com/pablogsal
Nov 12, 2017https://github.com/python/cpython/pull/4224/files#r150399462
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
ncoghlanhttps://github.com/ncoghlan
Nov 12, 2017https://github.com/python/cpython/pull/4224/files#r150399914
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://www.python.org/dev/peps/pep-0556/https://www.python.org/dev/peps/pep-0556/
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
pablogsalhttps://github.com/pablogsal
Nov 13, 2017https://github.com/python/cpython/pull/4224/files#r150508399
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@ncoghlanhttps://github.com/ncoghlan
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
pablogsalhttps://github.com/pablogsal
Nov 13, 2017https://github.com/python/cpython/pull/4224/files#r150512660
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/4224/files
https://github.com/python/cpython/pull/4224/files#diff-05935c597d9a54198ea38912d661147c8b1a0091df37848a709b599c462098fa
Include/internal/mem.hhttps://github.com/python/cpython/pull/4224/files#diff-5445a89d16dd9700d90572e201caa96db6a00920b743685b2db99d6a55c17e92
View file https://github.com/pablogsal/cpython/blob/00222b4a6ec6041b3d651b19b501080cf0b8e0f3/Include/internal/mem.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/4224/{{ revealButtonHref }}
https://github.com/python/cpython/pull/4224/files#diff-5445a89d16dd9700d90572e201caa96db6a00920b743685b2db99d6a55c17e92
https://github.com/python/cpython/pull/4224/files#diff-5445a89d16dd9700d90572e201caa96db6a00920b743685b2db99d6a55c17e92
Lib/test/test_gc.pyhttps://github.com/python/cpython/pull/4224/files#diff-9d9e863bd2a456b669ec9600be793699e861340d91d7c417a8a5b5b8cfbd09a7
View file https://github.com/pablogsal/cpython/blob/00222b4a6ec6041b3d651b19b501080cf0b8e0f3/Lib/test/test_gc.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/4224/{{ revealButtonHref }}
https://github.com/python/cpython/pull/4224/files#diff-9d9e863bd2a456b669ec9600be793699e861340d91d7c417a8a5b5b8cfbd09a7
https://github.com/python/cpython/pull/4224/files#diff-9d9e863bd2a456b669ec9600be793699e861340d91d7c417a8a5b5b8cfbd09a7
https://github.com/python/cpython/pull/4224/files#diff-9d9e863bd2a456b669ec9600be793699e861340d91d7c417a8a5b5b8cfbd09a7
Misc/NEWS.d/next/Core and Builtins/2017-11-02-00-34-42.bpo-31356.54Lb8U.rsthttps://github.com/python/cpython/pull/4224/files#diff-b66a3cc1dcec46ec526f3b61d53ef293a696681d23d72ce57cd2e886641b751c
View file https://github.com/pablogsal/cpython/blob/00222b4a6ec6041b3d651b19b501080cf0b8e0f3/Misc/NEWS.d/next/Core%20and%20Builtins/2017-11-02-00-34-42.bpo-31356.54Lb8U.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/4224/{{ revealButtonHref }}
Modules/gcmodule.chttps://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
View file https://github.com/pablogsal/cpython/blob/00222b4a6ec6041b3d651b19b501080cf0b8e0f3/Modules/gcmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/4224/{{ revealButtonHref }}
https://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
https://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
https://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
https://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
https://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
https://github.com/python/cpython/pull/4224/files#diff-3ba495fac5f4cc4a582187117515f3177ab91823c65a59af962fe180e06d9e77
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.