GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — asyncio exception handler called with incorrect context · Issue #96704 · python/cpython Closed Labels 3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionReproducer: import asyncio import contextvars name = contextvars.ContextVar('name', default='foo') def exc_handler(*args): assert name.get() == 'bar' async def task(): name.set('bar') 1/0 async def main(): loop = asyncio.get_running_loop() loop.set_exception_handler(exc_handler) asyncio.create_task(task()) asyncio.run(main()) On main: Unhandled error in exception handler context: {'message': 'Task exception was never retrieved', 'exception': ZeroDivisionError('division by zero'), 'future': <Task finished name='Task-2' coro=<task() done, defined at /workspaces/cpython/main.py:11> exception=ZeroDivisionError('division by zero')>} Traceback (most recent call last): File "/workspaces/cpython/Lib/asyncio/base_events.py", line 1797, in call_exception_handler self._exception_handler(self, context) File "/workspaces/cpython/main.py", line 8, in exc_handler assert name.get() == 'bar' AssertionError The exception handler is called with incorrect context hence the Activity
MetadataMetadataAssigneesLabels3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |