Title: all deprecation warnings are disabled for the whole process while new unix asyncio subprocesses are created · Issue #98327 · python/cpython · GitHub
Open Graph Title: all deprecation warnings are disabled for the whole process while new unix asyncio subprocesses are created · Issue #98327 · python/cpython
X Title: all deprecation warnings are disabled for the whole process while new unix asyncio subprocesses are created · Issue #98327 · python/cpython
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: Deprecati...
Open Graph 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/grainger...
X 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) /hom...
Opengraph URL: https://github.com/python/cpython/issues/98327
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"all deprecation warnings are disabled for the whole process while new unix asyncio subprocesses are created","articleBody":"on python3.10 the following prints:\r\n\r\n```\r\npython3.10 demo.py \r\n/home/graingert/projects/cpython/demo.py:40: DeprecationWarning: demo warning\r\n warnings.warn(\"demo warning\", DeprecationWarning)\r\n/home/graingert/projects/cpython/demo.py:48: DeprecationWarning: demo warning2\r\n warnings.warn(\"demo warning2\", DeprecationWarning)\r\n```\r\n\r\nbut on python main it prints:\r\n\r\n```\r\n./python demo.py \r\n/home/graingert/projects/cpython/demo.py:40: DeprecationWarning: demo warning\r\n warnings.warn(\"demo warning\", DeprecationWarning)\r\n```\r\n\r\n```python\r\nimport sys\r\nimport threading\r\nimport asyncio\r\nimport concurrent.futures\r\nimport warnings\r\n\r\n\r\nasync def acreate_process_then_sleep(started_event, stop_event):\r\n event = asyncio.Event()\r\n\r\n async def create_process():\r\n loop = asyncio.get_running_loop()\r\n loop.call_soon(event.set)\r\n proc = await asyncio.create_subprocess_exec(\r\n sys.executable,\r\n \"-c\",\r\n \"print('hello')\",\r\n stdin=None,\r\n stdout=asyncio.subprocess.PIPE,\r\n stderr=asyncio.subprocess.STDOUT,\r\n )\r\n await proc.communicate()\r\n\r\n async def sleep():\r\n await event.wait()\r\n started_event.set()\r\n stop_event.wait()\r\n\r\n await asyncio.gather(create_process(), sleep())\r\n\r\n\r\ndef create_process_then_sleep(*args, **kwargs):\r\n asyncio.run(acreate_process_then_sleep(*args, **kwargs))\r\n\r\n\r\ndef main():\r\n with concurrent.futures.ThreadPoolExecutor() as tpe:\r\n stop_event = threading.Event()\r\n started_event = threading.Event()\r\n warnings.warn(\"demo warning\", DeprecationWarning)\r\n fut = tpe.submit(\r\n create_process_then_sleep,\r\n started_event=started_event,\r\n stop_event=stop_event,\r\n )\r\n try:\r\n started_event.wait()\r\n warnings.warn(\"demo warning2\", DeprecationWarning)\r\n finally:\r\n stop_event.set()\r\n fut.result()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n sys.exit(main())\r\n```\r\n\r\n_Originally posted by @graingert in https://github.com/python/cpython/pull/98215#discussion_r996426251_\r\n ","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2022-10-16T11:55:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/98327/cpython/issues/98327"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:87728697-27f5-a942-54ad-6a1154bb00c7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6BC:250A02:97D3AA:CA733E:69697E06 |
| html-safe-nonce | 06e18dc330b45233e46d91e1c5c9e0077796269caee514addc9a7257d1f34800 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkJDOjI1MEEwMjo5N0QzQUE6Q0E3MzNFOjY5Njk3RTA2IiwidmlzaXRvcl9pZCI6IjIwOTk1OTE0ODMwNjMxMDcwNzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fe91f4cdfc34cb14da851725b569c9a09ef94e1e50dcb54c5294c4f1e802220e |
| hovercard-subject-tag | issue:1410465328 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/98327/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8e142f7610a5e16f468e8aacbc08a379b896dd6d232681a97cc24642e96d6a5/python/cpython/issues/98327 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8e142f7610a5e16f468e8aacbc08a379b896dd6d232681a97cc24642e96d6a5/python/cpython/issues/98327 |
| og:image:alt | 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/grainger... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | graingert |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width