Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
Description
on python3.10 the following prints:
python3.10 demo.py /home/graingert/projects/cpython/demo.py:40: DeprecationWarning: demo warning warnings.warn("demo warning", DeprecationWarning) /home/graingert/projects/cpython/demo.py:48: DeprecationWarning: demo warning2 warnings.warn("demo warning2", DeprecationWarning) but on python main it prints:
./python demo.py /home/graingert/projects/cpython/demo.py:40: DeprecationWarning: demo warning warnings.warn("demo warning", DeprecationWarning) importsysimportthreadingimportasyncioimportconcurrent.futuresimportwarningsasyncdefacreate_process_then_sleep(started_event, stop_event): event=asyncio.Event() asyncdefcreate_process(): loop=asyncio.get_running_loop() loop.call_soon(event.set) proc=awaitasyncio.create_subprocess_exec( sys.executable, "-c", "print('hello')", stdin=None, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT, ) awaitproc.communicate() asyncdefsleep(): awaitevent.wait() started_event.set() stop_event.wait() awaitasyncio.gather(create_process(), sleep()) defcreate_process_then_sleep(*args, **kwargs): asyncio.run(acreate_process_then_sleep(*args, **kwargs)) defmain(): withconcurrent.futures.ThreadPoolExecutor() astpe: stop_event=threading.Event() started_event=threading.Event() warnings.warn("demo warning", DeprecationWarning) fut=tpe.submit( create_process_then_sleep, started_event=started_event, stop_event=stop_event, ) try: started_event.wait() warnings.warn("demo warning2", DeprecationWarning) finally: stop_event.set() fut.result() if__name__=="__main__": sys.exit(main())Originally posted by @graingert in #98215 (comment)
Metadata
Metadata
Assignees
Labels
Projects
Status
Done