René's URL Explorer Experiment


Title: The REPL hangs under low memory on main · Issue #140080 · python/cpython · GitHub

Open Graph Title: The REPL hangs under low memory on main · Issue #140080 · python/cpython

X Title: The REPL hangs under low memory on main · Issue #140080 · python/cpython

Description: Bug report Bug description: Its kind of the same issue like #134163 so cc @ZeroIntensity @picnixz but the root cause is very different import _testcapi _testcapi.set_nomemory(100) # or 0 or 1000 it will print the error and hang forever [...

Open Graph Description: Bug report Bug description: Its kind of the same issue like #134163 so cc @ZeroIntensity @picnixz but the root cause is very different import _testcapi _testcapi.set_nomemory(100) # or 0 or 1000 it...

X Description: Bug report Bug description: Its kind of the same issue like #134163 so cc @ZeroIntensity @picnixz but the root cause is very different import _testcapi _testcapi.set_nomemory(100) # or 0 or 1000 it...

Opengraph URL: https://github.com/python/cpython/issues/140080

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The REPL hangs under low memory on main","articleBody":"# Bug report\n\n### Bug description:\n\nIts kind of the same issue like https://github.com/python/cpython/issues/134163\nso cc @ZeroIntensity @picnixz \n\nbut the root cause is very different \n\n\n```python\nimport _testcapi\n_testcapi.set_nomemory(100) # or 0 or 1000\n```\nit will print the error and hang forever\n\n```py\n[hyi@rocky cpython]$ ./python \nPython 3.15.0a0 (heads/main:8e0bf4fe5d7, Oct 14 2025, 14:01:02) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\u003e\u003e\u003e import _testcapi\n\u003e\u003e\u003e _testcapi.set_nomemory(0)\nobject address  : 0xffff9c12dea0\nobject refcount : 3\nobject type     : 0x927c48\nobject type name: MemoryError\nobject repr     : \nlost sys.stderr\n# hang here\n```\n\nthe root cause is easy but the fix maybe hard and need to discuss so only issue\nand digging here no patch\n\nsome dig:\n\n- it only happens in main 3.15 and recent commits\n- it happends on all system\n- both old and default REPL hava it\n- its hard to reproduce without repl\n\nthe root cause can check bt\n\n```bt\n➜  ~  lldb -p 23325\n(lldb) process attach --pid 23325\nwarning: python.exe was compiled with optimization - stepping may behave oddly; variables may not be available.\nProcess 23325 stopped\n* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP\n    frame #0: 0x0000000100bac6c4 python.exe`BaseException_clear(op=0x00000001011c1e40) at exceptions.c:135:5 [opt]\n   132 \tBaseException_clear(PyObject *op)\n   133 \t{\n   134 \t   PyBaseExceptionObject *self = PyBaseExceptionObject_CAST(op);\n-\u003e 135 \t   Py_CLEAR(self-\u003edict);\n   136 \t   Py_CLEAR(self-\u003eargs);\n   137 \t   Py_CLEAR(self-\u003enotes);\n   138 \t   Py_CLEAR(self-\u003etraceback);\nTarget 0: (python.exe) stopped.\nExecutable binary set to \"/Users/hyi/prs/cpython/python.exe\".\nArchitecture set to: arm64-apple-macosx-.\n(lldb) bt\n* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP\n  * frame #0: 0x0000000100bac6c4 python.exe`BaseException_clear(op=0x00000001011c1e40) at exceptions.c:135:5 [opt]\n    frame #1: 0x0000000100bac58c python.exe`MemoryError_dealloc(op=0x00000001011c1e40) at exceptions.c:4099:11 [opt]\n    frame #2: 0x0000000100bf8fac python.exe`_Py_Dealloc(op=0x00000001011c1e40) at object.c:3200:5 [opt]\n    frame #3: 0x0000000100d0c9ac python.exe`format_unraisable_v [inlined] Py_DECREF(op=0x00000001011c1e40) at refcount.h:418:9 [opt]\n    frame #4: 0x0000000100d0c9a4 python.exe`format_unraisable_v [inlined] Py_XDECREF(op=0x00000001011c1e40) at refcount.h:511:9 [opt]\n    frame #5: 0x0000000100d0c9a4 python.exe`format_unraisable_v(format=\u003cunavailable\u003e, va=\"8X\\xa2\\U00000001\\U00000001\", obj=0x0000000000000000) at errors.c:1746:5 [opt]\n    frame #6: 0x0000000100d0c428 python.exe`PyErr_FormatUnraisable(format=\u003cunavailable\u003e) at errors.c:1769:5 [opt]\n    frame #7: 0x0000000100d8017c python.exe`atexit_callfuncs(state=\u003cunavailable\u003e) at atexitmodule.c:113:9 [opt] [artificial]\n    frame #8: 0x0000000100d80070 python.exe`_PyAtExit_Call(interp=\u003cunavailable\u003e) at atexitmodule.c:151:5 [opt] [artificial]\n    frame #9: 0x0000000100d471b0 python.exe`make_pre_finalization_calls(tstate=0x0000000100ff8bc0, subinterpreters=1) at pylifecycle.c:2108:9 [opt]\n    frame #10: 0x0000000100d468dc python.exe`_Py_Finalize(runtime=\u003cunavailable\u003e) at pylifecycle.c:2167:5 [opt]\n    frame #11: 0x0000000100d46828 python.exe`Py_FinalizeEx at pylifecycle.c:2378:12 [opt] [artificial]\n    frame #12: 0x0000000100d76854 python.exe`Py_RunMain at main.c:774:9 [opt]\n    frame #13: 0x0000000100d76fec python.exe`pymain_main(args=0x000000016f2b6140) at main.c:802:12 [opt]\n    frame #14: 0x0000000100d7708c python.exe`Py_BytesMain(argc=\u003cunavailable\u003e, argv=\u003cunavailable\u003e) at main.c:826:12 [opt]\n    frame #15: 0x000000019a2e5d54 dyld`start + 7184\n(lldb) \n```\n\n- with the perf can check the fucntion\n```bt\n[hyi@rocky ~]$ perf annotate -l --stdio --symbol PyErr_FormatUnraisable\n\nSorted summary for file /home/hyi/cpython/python\n----------------------------------------------\n\n   55.56 errors.c:1765\n   29.63 errors.c:1771\n   14.81 errors.c:1768\n Percent |      Source code \u0026 Disassembly of python for task-clock:upppH (27 samples, percent: local period)\n------------------------------------------------------------------------------------------------------------\n         :\n         :\n         :\n         : 3      Disassembly of section .text:\n         :\n         : 5      0000000000614ac0 \u003cPyErr_FormatUnraisable\u003e:\n         : 6      _PyErr_Clear(tstate); /* Just in case */\n         : 7      }\n         :\n         : 9      void\n         : 10     PyErr_FormatUnraisable(const char *format, ...)\n         : 11     {\n    0.00 :   614ac0: stp     x29, x30, [sp, #-272]!\n         : 13     va_list va;\n         :\n         : 15     va_start(va, format);\n    0.00 :   614ac4: mov     w9, #0xffffffc8                 // #-56\n    0.00 :   614ac8: mov     w8, #0xffffff80                 // #-128\n         : 18     {\n    0.00 :   614acc: mov     x29, sp\n         : 20     va_start(va, format);\n    0.00 :   614ad0: add     x10, sp, #0xd0\n    0.00 :   614ad4: add     x11, sp, #0x110\n```\n\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-140103\n* gh-140161\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/yihong0618","@type":"Person","name":"yihong0618"},"datePublished":"2025-10-14T07:25:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/140080/cpython/issues/140080"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b4e7bc9e-f763-5b76-5550-785908ffea3d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idACF6:FE603:6B8310:8B6CE6:696AEC41
html-safe-noncecd4ec0e3675eb8ef510f3468cfbfb5c42ab680aace3f2a341a21da7b5535a55e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0Y2OkZFNjAzOjZCODMxMDo4QjZDRTY6Njk2QUVDNDEiLCJ2aXNpdG9yX2lkIjoiNTI4MjY4Mjg4NTMzNDgyMTk1MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac83a8bcbfbf19c04c437b81e22b72dd31661822edf7ea8abd0e48ea2bf27bef4e
hovercard-subject-tagissue:3512703749
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/140080/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ba5e75c8f94148f59852474c401001bb11bc774ca2ee1b832adc1591c0182d1f/python/cpython/issues/140080
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ba5e75c8f94148f59852474c401001bb11bc774ca2ee1b832adc1591c0182d1f/python/cpython/issues/140080
og:image:altBug report Bug description: Its kind of the same issue like #134163 so cc @ZeroIntensity @picnixz but the root cause is very different import _testcapi _testcapi.set_nomemory(100) # or 0 or 1000 it...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameyihong0618
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/140080#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F140080
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2Fissues%2F140080
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/140080
Reloadhttps://github.com/python/cpython/issues/140080
Reloadhttps://github.com/python/cpython/issues/140080
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/140080
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k 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.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/140080
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 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/140080
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/140080
The REPL hangs under low memory on mainhttps://github.com/python/cpython/issues/140080#top
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
topic-replRelated to the interactive shellhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-repl%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/yihong0618
https://github.com/yihong0618
yihong0618https://github.com/yihong0618
on Oct 14, 2025https://github.com/python/cpython/issues/140080#issue-3512703749
#134163https://github.com/python/cpython/issues/134163
@ZeroIntensityhttps://github.com/ZeroIntensity
@picnixzhttps://github.com/picnixz
gh-140080: Fix atexit with low memory #140103https://github.com/python/cpython/pull/140103
[3.14] gh-140080: chore test test_atexit_with_low_memory from main #140161https://github.com/python/cpython/pull/140161
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
topic-replRelated to the interactive shellhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-repl%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
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.