[issue43419] contextvars does not work properly in asyncio REPL.

2021-03-06 Thread Lanfon


Change by Lanfon :


--
keywords: +patch
pull_requests: +23541
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24773

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43419] contextvars does not work properly in asyncio REPL.

2021-03-06 Thread Lanfon


New submission from Lanfon :

Demonstration (via python -m asyncio):

asyncio REPL 3.9.0 (default, Oct 18 2020, 00:21:26) 
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> from contextvars import ContextVar
>>> ctx = ContextVar('ctx')
>>> ctx.set(1)
 at 0x1021bf800>
>>> ctx.get()
Traceback (most recent call last):
  File 
"/Users/lanfon/.pyenv/versions/3.9.0/lib/python3.9/concurrent/futures/_base.py",
 line 440, in result
return self.__get_result()
  File 
"/Users/lanfon/.pyenv/versions/3.9.0/lib/python3.9/concurrent/futures/_base.py",
 line 389, in __get_result
raise self._exception
  File "/Users/lanfon/.pyenv/versions/3.9.0/lib/python3.9/asyncio/__main__.py", 
line 34, in callback
coro = func()
  File "", line 1, in 
LookupError: 
>>> exit()


It also got problem inside the functions when the context is referenced in 
global scope.

--
components: asyncio
messages: 388199
nosy: asvetlov, lanfon72, yselivanov
priority: normal
severity: normal
status: open
title: contextvars does not work properly in asyncio REPL.
type: behavior
versions: Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com