Title: gh-146194: Fix nested KeyboardInterrupt handling in asyncio by okiemute04 · Pull Request #146203 · python/cpython · GitHub
Open Graph Title: gh-146194: Fix nested KeyboardInterrupt handling in asyncio by okiemute04 · Pull Request #146203 · python/cpython
X Title: gh-146194: Fix nested KeyboardInterrupt handling in asyncio by okiemute04 · Pull Request #146203 · python/cpython
Description: Fixes #146194 Problem When multiple Ctrl+C presses occurred in nested asyncio tasks, the third press would cause a crash with "Task was destroyed but it is pending!" instead of gracefully cancelling the nested tasks. Solution Modified _on_sigint in Lib/asyncio/runners.py to cancel the main task on every SIGINT, allowing nested cancellations to propagate correctly through multiple levels. Testing Added test_nested_keyboardinterrupt_handling to test_runners.py Verified that multiple cancellations work correctly without crashes All existing runner tests pass Issue: gh-146194
Open Graph Description: Fixes #146194 Problem When multiple Ctrl+C presses occurred in nested asyncio tasks, the third press would cause a crash with "Task was destroyed but it is pending!" instead of gracefully...
X Description: Fixes #146194 Problem When multiple Ctrl+C presses occurred in nested asyncio tasks, the third press would cause a crash with "Task was destroyed but it is pending!" instead of gr...
Opengraph URL: https://github.com/python/cpython/pull/146203
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ce467ee5-df40-31f4-308f-99ff36faf682 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A93C:1E565C:58D1AB:77D0A7:6A527E2F |
| html-safe-nonce | 001b9a2c1879b480983556bb419f91c2ebbd4a2511bce379550ee4f1431499c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTNDOjFFNTY1Qzo1OEQxQUI6NzdEMEE3OjZBNTI3RTJGIiwidmlzaXRvcl9pZCI6IjYwNzkzNzEwMzYzOTgzNTM5NjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 74319ab3ee94ac104349c9fe9b5c4887b3efda5a338589a4e06bf4ac09d6867b |
| hovercard-subject-tag | pull_request:3424555609 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/146203/files |
| twitter:image | https://avatars.githubusercontent.com/u/51956662?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/51956662?s=400&v=4 |
| og:image:alt | Fixes #146194 Problem When multiple Ctrl+C presses occurred in nested asyncio tasks, the third press would cause a crash with "Task was destroyed but it is pending!" instead of gracefully... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width