From 74be3865a323fd6bad6046a2ec59659f6a57d7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 9 Jan 2023 13:19:27 +0000 Subject: [PATCH 1/6] Fix `asyncio` subprocess losing `stderr` and `stdout` output Reported as a regression in https://bodhi.fedoraproject.org/updates/FEDORA-2022-dbb811d203 --- ...cess-losing-stderr-and-stdout-output.patch | 66 +++++++++++++++++++ python3.11.spec | 9 ++- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch diff --git a/00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch b/00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch new file mode 100644 index 0000000..c480127 --- /dev/null +++ b/00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "Miss Islington (bot)" + <31488909+miss-islington@users.noreply.github.com> +Date: Wed, 21 Dec 2022 02:24:19 -0800 +Subject: [PATCH] 00395: GH-100133: fix `asyncio` subprocess losing `stderr` + and `stdout` output + +(cherry picked from commit a7715ccfba5b86ab09f86ec56ac3755c93b46b48) + +Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> +--- + Lib/asyncio/base_subprocess.py | 3 --- + Lib/test/test_asyncio/test_subprocess.py | 17 +++++++++++++++++ + ...22-12-10-08-36-07.gh-issue-100133.g-zQlp.rst | 1 + + 3 files changed, 18 insertions(+), 3 deletions(-) + create mode 100644 Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst + +diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py +index e15bb4141f..4c9b0dd565 100644 +--- a/Lib/asyncio/base_subprocess.py ++++ b/Lib/asyncio/base_subprocess.py +@@ -215,9 +215,6 @@ def _process_exited(self, returncode): + # object. On Python 3.6, it is required to avoid a ResourceWarning. + self._proc.returncode = returncode + self._call(self._protocol.process_exited) +- for p in self._pipes.values(): +- if p is not None: +- p.pipe.close() + + self._try_finish() + +diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py +index f71ad72f99..bea2314a52 100644 +--- a/Lib/test/test_asyncio/test_subprocess.py ++++ b/Lib/test/test_asyncio/test_subprocess.py +@@ -684,6 +684,23 @@ async def execute(): + + self.assertIsNone(self.loop.run_until_complete(execute())) + ++ def test_subprocess_communicate_stdout(self): ++ # See https://github.com/python/cpython/issues/100133 ++ async def get_command_stdout(cmd, *args): ++ proc = await asyncio.create_subprocess_exec( ++ cmd, *args, stdout=asyncio.subprocess.PIPE, ++ ) ++ stdout, _ = await proc.communicate() ++ return stdout.decode().strip() ++ ++ async def main(): ++ outputs = [f'foo{i}' for i in range(10)] ++ res = await asyncio.gather(*[get_command_stdout(sys.executable, '-c', ++ f'print({out!r})') for out in outputs]) ++ self.assertEqual(res, outputs) ++ ++ self.loop.run_until_complete(main()) ++ + + if sys.platform != 'win32': + # Unix +diff --git a/Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst b/Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst +new file mode 100644 +index 0000000000..881e6ed80f +--- /dev/null ++++ b/Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst +@@ -0,0 +1 @@ ++Fix regression in :mod:`asyncio` where a subprocess would sometimes lose data received from pipe. diff --git a/python3.11.spec b/python3.11.spec index 8f48027..f7e514d 100644 --- a/python3.11.spec +++ b/python3.11.spec @@ -17,7 +17,7 @@ URL: https://www.python.org/ #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 1%{?dist} +Release: 3%{?dist} License: Python-2.0.1 @@ -323,6 +323,10 @@ Patch328: 00328-pyc-timestamp-invalidation-mode.patch # https://github.com/GrahamDumpleton/mod_wsgi/issues/730 Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch +# 00395 # 18ff37a92c507144edf32274b356dd1dd734cf07 +# GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output +Patch395: 00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -1595,6 +1599,9 @@ CheckPython optimized # ====================================================== %changelog +* Fri Jan 06 2023 Miro Hrončok - 3.11.1-3 +- Fix `asyncio` subprocess losing `stderr` and `stdout` output + * Wed Dec 07 2022 Tomáš Hrnčiar - 3.11.1-1 - Update to 3.11.1 From d3687aa7a3985819df1cb50f4e90d6c3fea046b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 11 Jan 2023 15:25:19 +0100 Subject: [PATCH 2/6] Remove any deprecation warnings in asyncio.get_event_loop() The warnings were added in 3.11.1 and will be reverted in 3.11.2. They make some Fedora packages fail to build, so we backport the revert. --- ...n-warnings-in-asyncio-get_event_loop.patch | 171 ++++++++++++++++++ python3.11.spec | 7 + 2 files changed, 178 insertions(+) create mode 100644 00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch diff --git a/00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch b/00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch new file mode 100644 index 0000000..bebae56 --- /dev/null +++ b/00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch @@ -0,0 +1,171 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Serhiy Storchaka +Date: Tue, 10 Jan 2023 22:20:09 +0200 +Subject: [PATCH] 00396: gh-100160: Remove any deprecation warnings in + asyncio.get_event_loop() + +Some deprecation warnings will reappear (in a slightly different form) in 3.12. + +Co-authored-by: Guido van Rossum +--- + Doc/library/asyncio-eventloop.rst | 14 +++++++------- + Doc/library/asyncio-policy.rst | 9 +++++---- + Doc/whatsnew/3.10.rst | 13 ------------- + Lib/asyncio/events.py | 15 --------------- + Lib/test/test_asyncio/test_events.py | 12 +++--------- + ...2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst | 2 ++ + 6 files changed, 17 insertions(+), 48 deletions(-) + create mode 100644 Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst + +diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst +index 28b7a90058..886399e7ae 100644 +--- a/Doc/library/asyncio-eventloop.rst ++++ b/Doc/library/asyncio-eventloop.rst +@@ -48,7 +48,7 @@ an event loop: + running event loop. + + If there is no running event loop set, the function will return +- the result of ``get_event_loop_policy().get_event_loop()`` call. ++ the result of the ``get_event_loop_policy().get_event_loop()`` call. + + Because this function has rather complex behavior (especially + when custom event loop policies are in use), using the +@@ -59,15 +59,15 @@ an event loop: + instead of using these lower level functions to manually create and close an + event loop. + +- .. deprecated:: 3.10 +- Deprecation warning is emitted if there is no current event loop. +- In Python 3.12 it will be an error. +- + .. note:: + In Python versions 3.10.0--3.10.8 and 3.11.0 this function +- (and other functions which used it implicitly) emitted a ++ (and other functions which use it implicitly) emitted a + :exc:`DeprecationWarning` if there was no running event loop, even if +- the current loop was set. ++ the current loop was set on the policy. ++ In Python versions 3.10.9, 3.11.1 and 3.12 they emit a ++ :exc:`DeprecationWarning` if there is no running event loop and no ++ current loop is set. ++ In some future Python release this will become an error. + + .. function:: set_event_loop(loop) + +diff --git a/Doc/library/asyncio-policy.rst b/Doc/library/asyncio-policy.rst +index d0af45febd..eb043b3e5e 100644 +--- a/Doc/library/asyncio-policy.rst ++++ b/Doc/library/asyncio-policy.rst +@@ -112,10 +112,11 @@ asyncio ships with the following built-in policies: + + On Windows, :class:`ProactorEventLoop` is now used by default. + +- .. deprecated:: 3.11.1 +- :meth:`get_event_loop` now emits a :exc:`DeprecationWarning` if there +- is no current event loop set and a new event loop has been implicitly +- created. In Python 3.12 it will be an error. ++ .. note:: ++ In Python versions 3.10.9, 3.11.1 and 3.12 this function emits a ++ :exc:`DeprecationWarning` if there is no running event loop and no ++ current loop is set. ++ In some future Python release this will become an error. + + + .. class:: WindowsSelectorEventLoopPolicy +diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst +index d0b436664a..38b30deff7 100644 +--- a/Doc/whatsnew/3.10.rst ++++ b/Doc/whatsnew/3.10.rst +@@ -1710,19 +1710,6 @@ Deprecated + scheduled for removal in Python 3.12. + (Contributed by Erlend E. Aasland in :issue:`42264`.) + +-* :func:`asyncio.get_event_loop` now emits a deprecation warning if there is +- no running event loop. In the future it will be an alias of +- :func:`~asyncio.get_running_loop`. +- :mod:`asyncio` functions which implicitly create :class:`~asyncio.Future` +- or :class:`~asyncio.Task` objects now emit +- a deprecation warning if there is no running event loop and no explicit +- *loop* argument is passed: :func:`~asyncio.ensure_future`, +- :func:`~asyncio.wrap_future`, :func:`~asyncio.gather`, +- :func:`~asyncio.shield`, :func:`~asyncio.as_completed` and constructors of +- :class:`~asyncio.Future`, :class:`~asyncio.Task`, +- :class:`~asyncio.StreamReader`, :class:`~asyncio.StreamReaderProtocol`. +- (Contributed by Serhiy Storchaka in :issue:`39529`.) +- + * The undocumented built-in function ``sqlite3.enable_shared_cache`` is now + deprecated, scheduled for removal in Python 3.12. Its use is strongly + discouraged by the SQLite3 documentation. See `the SQLite3 docs +diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py +index af3f9e970b..b1799320ea 100644 +--- a/Lib/asyncio/events.py ++++ b/Lib/asyncio/events.py +@@ -671,21 +671,6 @@ def get_event_loop(self): + if (self._local._loop is None and + not self._local._set_called and + threading.current_thread() is threading.main_thread()): +- stacklevel = 2 +- try: +- f = sys._getframe(1) +- except AttributeError: +- pass +- else: +- while f: +- module = f.f_globals.get('__name__') +- if not (module == 'asyncio' or module.startswith('asyncio.')): +- break +- f = f.f_back +- stacklevel += 1 +- import warnings +- warnings.warn('There is no current event loop', +- DeprecationWarning, stacklevel=stacklevel) + self.set_event_loop(self.new_event_loop()) + + if self._local._loop is None: +diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py +index c431fea401..18c4fd15d9 100644 +--- a/Lib/test/test_asyncio/test_events.py ++++ b/Lib/test/test_asyncio/test_events.py +@@ -2547,9 +2547,7 @@ def test_event_loop_policy(self): + def test_get_event_loop(self): + policy = asyncio.DefaultEventLoopPolicy() + self.assertIsNone(policy._local._loop) +- with self.assertWarns(DeprecationWarning) as cm: +- loop = policy.get_event_loop() +- self.assertEqual(cm.filename, __file__) ++ loop = policy.get_event_loop() + self.assertIsInstance(loop, asyncio.AbstractEventLoop) + + self.assertIs(policy._local._loop, loop) +@@ -2563,10 +2561,8 @@ def test_get_event_loop_calls_set_event_loop(self): + policy, "set_event_loop", + wraps=policy.set_event_loop) as m_set_event_loop: + +- with self.assertWarns(DeprecationWarning) as cm: +- loop = policy.get_event_loop() ++ loop = policy.get_event_loop() + self.addCleanup(loop.close) +- self.assertEqual(cm.filename, __file__) + + # policy._local._loop must be set through .set_event_loop() + # (the unix DefaultEventLoopPolicy needs this call to attach +@@ -2755,10 +2751,8 @@ def test_get_event_loop_returns_running_loop2(self): + loop = asyncio.new_event_loop() + self.addCleanup(loop.close) + +- with self.assertWarns(DeprecationWarning) as cm: +- loop2 = asyncio.get_event_loop() ++ loop2 = asyncio.get_event_loop() + self.addCleanup(loop2.close) +- self.assertEqual(cm.filename, __file__) + asyncio.set_event_loop(None) + with self.assertRaisesRegex(RuntimeError, 'no current'): + asyncio.get_event_loop() +diff --git a/Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst b/Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst +new file mode 100644 +index 0000000000..c3b518ca85 +--- /dev/null ++++ b/Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst +@@ -0,0 +1,2 @@ ++Remove any deprecation warnings in :func:`asyncio.get_event_loop`. They are ++deferred to Python 3.12. diff --git a/python3.11.spec b/python3.11.spec index f7e514d..17e0d3e 100644 --- a/python3.11.spec +++ b/python3.11.spec @@ -327,6 +327,12 @@ Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-g # GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output Patch395: 00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch +# 00396 # 4c775fbed65016fec5dfd66316559024d2af9135 +# gh-100160: Remove any deprecation warnings in asyncio.get_event_loop() +# +# Some deprecation warnings will reappear (in a slightly different form) in 3.12. +Patch396: 00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -1601,6 +1607,7 @@ CheckPython optimized %changelog * Fri Jan 06 2023 Miro Hrončok - 3.11.1-3 - Fix `asyncio` subprocess losing `stderr` and `stdout` output +- Remove any deprecation warnings in asyncio.get_event_loop() * Wed Dec 07 2022 Tomáš Hrnčiar - 3.11.1-1 - Update to 3.11.1 From b4039077499ae60f98256f430ad49a93e8bccb6c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 20 Jan 2023 18:45:09 +0000 Subject: [PATCH 3/6] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python3.11.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python3.11.spec b/python3.11.spec index 17e0d3e..8df303f 100644 --- a/python3.11.spec +++ b/python3.11.spec @@ -17,7 +17,7 @@ URL: https://www.python.org/ #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 3%{?dist} +Release: 4%{?dist} License: Python-2.0.1 @@ -1605,6 +1605,9 @@ CheckPython optimized # ====================================================== %changelog +* Fri Jan 20 2023 Fedora Release Engineering - 3.11.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Fri Jan 06 2023 Miro Hrončok - 3.11.1-3 - Fix `asyncio` subprocess losing `stderr` and `stdout` output - Remove any deprecation warnings in asyncio.get_event_loop() From 6ef5513ed4f974f10a24d8700ad6f178bab2af60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 12 Jan 2023 16:39:34 +0000 Subject: [PATCH 4/6] Don't require pyproject-rpm-macros on RHEL See also https://src.fedoraproject.org/rpms/pyproject-rpm-macros/pull-request/345 --- python3.11.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python3.11.spec b/python3.11.spec index 8df303f..ded2dde 100644 --- a/python3.11.spec +++ b/python3.11.spec @@ -492,7 +492,11 @@ Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release} # But we want them when packages BuildRequire python3-devel Requires: (python-rpm-macros if rpm-build) Requires: (python3-rpm-macros if rpm-build) -Requires: (pyproject-rpm-macros if rpm-build) +# We omit this dependency on RHEL to avoid pulling the macros to AppStream: +# RHEL users can use the minimal implementation of %%pyproject_buildrequires +# from pyproject-srpm-macros instead. +# On Fedora, we keep this to avoid one additional round of %%generate_buildrequires. +%{!?rhel:Requires: (pyproject-rpm-macros if rpm-build)} %unversioned_obsoletes_of_python3_X_if_main devel From 86a68f7872dc47609ee99c301eea069fae34d1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Wed, 8 Feb 2023 16:08:24 +0100 Subject: [PATCH 5/6] Update to 3.11.2 --- ...cess-losing-stderr-and-stdout-output.patch | 66 ------- ...n-warnings-in-asyncio-get_event_loop.patch | 171 ------------------ python3.11.spec | 19 +- sources | 4 +- 4 files changed, 9 insertions(+), 251 deletions(-) delete mode 100644 00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch delete mode 100644 00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch diff --git a/00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch b/00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch deleted file mode 100644 index c480127..0000000 --- a/00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Miss Islington (bot)" - <31488909+miss-islington@users.noreply.github.com> -Date: Wed, 21 Dec 2022 02:24:19 -0800 -Subject: [PATCH] 00395: GH-100133: fix `asyncio` subprocess losing `stderr` - and `stdout` output - -(cherry picked from commit a7715ccfba5b86ab09f86ec56ac3755c93b46b48) - -Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> ---- - Lib/asyncio/base_subprocess.py | 3 --- - Lib/test/test_asyncio/test_subprocess.py | 17 +++++++++++++++++ - ...22-12-10-08-36-07.gh-issue-100133.g-zQlp.rst | 1 + - 3 files changed, 18 insertions(+), 3 deletions(-) - create mode 100644 Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst - -diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py -index e15bb4141f..4c9b0dd565 100644 ---- a/Lib/asyncio/base_subprocess.py -+++ b/Lib/asyncio/base_subprocess.py -@@ -215,9 +215,6 @@ def _process_exited(self, returncode): - # object. On Python 3.6, it is required to avoid a ResourceWarning. - self._proc.returncode = returncode - self._call(self._protocol.process_exited) -- for p in self._pipes.values(): -- if p is not None: -- p.pipe.close() - - self._try_finish() - -diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py -index f71ad72f99..bea2314a52 100644 ---- a/Lib/test/test_asyncio/test_subprocess.py -+++ b/Lib/test/test_asyncio/test_subprocess.py -@@ -684,6 +684,23 @@ async def execute(): - - self.assertIsNone(self.loop.run_until_complete(execute())) - -+ def test_subprocess_communicate_stdout(self): -+ # See https://github.com/python/cpython/issues/100133 -+ async def get_command_stdout(cmd, *args): -+ proc = await asyncio.create_subprocess_exec( -+ cmd, *args, stdout=asyncio.subprocess.PIPE, -+ ) -+ stdout, _ = await proc.communicate() -+ return stdout.decode().strip() -+ -+ async def main(): -+ outputs = [f'foo{i}' for i in range(10)] -+ res = await asyncio.gather(*[get_command_stdout(sys.executable, '-c', -+ f'print({out!r})') for out in outputs]) -+ self.assertEqual(res, outputs) -+ -+ self.loop.run_until_complete(main()) -+ - - if sys.platform != 'win32': - # Unix -diff --git a/Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst b/Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst -new file mode 100644 -index 0000000000..881e6ed80f ---- /dev/null -+++ b/Misc/NEWS.d/next/Library/2022-12-10-08-36-07.gh-issue-100133.g-zQlp.rst -@@ -0,0 +1 @@ -+Fix regression in :mod:`asyncio` where a subprocess would sometimes lose data received from pipe. diff --git a/00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch b/00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch deleted file mode 100644 index bebae56..0000000 --- a/00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch +++ /dev/null @@ -1,171 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Serhiy Storchaka -Date: Tue, 10 Jan 2023 22:20:09 +0200 -Subject: [PATCH] 00396: gh-100160: Remove any deprecation warnings in - asyncio.get_event_loop() - -Some deprecation warnings will reappear (in a slightly different form) in 3.12. - -Co-authored-by: Guido van Rossum ---- - Doc/library/asyncio-eventloop.rst | 14 +++++++------- - Doc/library/asyncio-policy.rst | 9 +++++---- - Doc/whatsnew/3.10.rst | 13 ------------- - Lib/asyncio/events.py | 15 --------------- - Lib/test/test_asyncio/test_events.py | 12 +++--------- - ...2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst | 2 ++ - 6 files changed, 17 insertions(+), 48 deletions(-) - create mode 100644 Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst - -diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst -index 28b7a90058..886399e7ae 100644 ---- a/Doc/library/asyncio-eventloop.rst -+++ b/Doc/library/asyncio-eventloop.rst -@@ -48,7 +48,7 @@ an event loop: - running event loop. - - If there is no running event loop set, the function will return -- the result of ``get_event_loop_policy().get_event_loop()`` call. -+ the result of the ``get_event_loop_policy().get_event_loop()`` call. - - Because this function has rather complex behavior (especially - when custom event loop policies are in use), using the -@@ -59,15 +59,15 @@ an event loop: - instead of using these lower level functions to manually create and close an - event loop. - -- .. deprecated:: 3.10 -- Deprecation warning is emitted if there is no current event loop. -- In Python 3.12 it will be an error. -- - .. note:: - In Python versions 3.10.0--3.10.8 and 3.11.0 this function -- (and other functions which used it implicitly) emitted a -+ (and other functions which use it implicitly) emitted a - :exc:`DeprecationWarning` if there was no running event loop, even if -- the current loop was set. -+ the current loop was set on the policy. -+ In Python versions 3.10.9, 3.11.1 and 3.12 they emit a -+ :exc:`DeprecationWarning` if there is no running event loop and no -+ current loop is set. -+ In some future Python release this will become an error. - - .. function:: set_event_loop(loop) - -diff --git a/Doc/library/asyncio-policy.rst b/Doc/library/asyncio-policy.rst -index d0af45febd..eb043b3e5e 100644 ---- a/Doc/library/asyncio-policy.rst -+++ b/Doc/library/asyncio-policy.rst -@@ -112,10 +112,11 @@ asyncio ships with the following built-in policies: - - On Windows, :class:`ProactorEventLoop` is now used by default. - -- .. deprecated:: 3.11.1 -- :meth:`get_event_loop` now emits a :exc:`DeprecationWarning` if there -- is no current event loop set and a new event loop has been implicitly -- created. In Python 3.12 it will be an error. -+ .. note:: -+ In Python versions 3.10.9, 3.11.1 and 3.12 this function emits a -+ :exc:`DeprecationWarning` if there is no running event loop and no -+ current loop is set. -+ In some future Python release this will become an error. - - - .. class:: WindowsSelectorEventLoopPolicy -diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst -index d0b436664a..38b30deff7 100644 ---- a/Doc/whatsnew/3.10.rst -+++ b/Doc/whatsnew/3.10.rst -@@ -1710,19 +1710,6 @@ Deprecated - scheduled for removal in Python 3.12. - (Contributed by Erlend E. Aasland in :issue:`42264`.) - --* :func:`asyncio.get_event_loop` now emits a deprecation warning if there is -- no running event loop. In the future it will be an alias of -- :func:`~asyncio.get_running_loop`. -- :mod:`asyncio` functions which implicitly create :class:`~asyncio.Future` -- or :class:`~asyncio.Task` objects now emit -- a deprecation warning if there is no running event loop and no explicit -- *loop* argument is passed: :func:`~asyncio.ensure_future`, -- :func:`~asyncio.wrap_future`, :func:`~asyncio.gather`, -- :func:`~asyncio.shield`, :func:`~asyncio.as_completed` and constructors of -- :class:`~asyncio.Future`, :class:`~asyncio.Task`, -- :class:`~asyncio.StreamReader`, :class:`~asyncio.StreamReaderProtocol`. -- (Contributed by Serhiy Storchaka in :issue:`39529`.) -- - * The undocumented built-in function ``sqlite3.enable_shared_cache`` is now - deprecated, scheduled for removal in Python 3.12. Its use is strongly - discouraged by the SQLite3 documentation. See `the SQLite3 docs -diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py -index af3f9e970b..b1799320ea 100644 ---- a/Lib/asyncio/events.py -+++ b/Lib/asyncio/events.py -@@ -671,21 +671,6 @@ def get_event_loop(self): - if (self._local._loop is None and - not self._local._set_called and - threading.current_thread() is threading.main_thread()): -- stacklevel = 2 -- try: -- f = sys._getframe(1) -- except AttributeError: -- pass -- else: -- while f: -- module = f.f_globals.get('__name__') -- if not (module == 'asyncio' or module.startswith('asyncio.')): -- break -- f = f.f_back -- stacklevel += 1 -- import warnings -- warnings.warn('There is no current event loop', -- DeprecationWarning, stacklevel=stacklevel) - self.set_event_loop(self.new_event_loop()) - - if self._local._loop is None: -diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py -index c431fea401..18c4fd15d9 100644 ---- a/Lib/test/test_asyncio/test_events.py -+++ b/Lib/test/test_asyncio/test_events.py -@@ -2547,9 +2547,7 @@ def test_event_loop_policy(self): - def test_get_event_loop(self): - policy = asyncio.DefaultEventLoopPolicy() - self.assertIsNone(policy._local._loop) -- with self.assertWarns(DeprecationWarning) as cm: -- loop = policy.get_event_loop() -- self.assertEqual(cm.filename, __file__) -+ loop = policy.get_event_loop() - self.assertIsInstance(loop, asyncio.AbstractEventLoop) - - self.assertIs(policy._local._loop, loop) -@@ -2563,10 +2561,8 @@ def test_get_event_loop_calls_set_event_loop(self): - policy, "set_event_loop", - wraps=policy.set_event_loop) as m_set_event_loop: - -- with self.assertWarns(DeprecationWarning) as cm: -- loop = policy.get_event_loop() -+ loop = policy.get_event_loop() - self.addCleanup(loop.close) -- self.assertEqual(cm.filename, __file__) - - # policy._local._loop must be set through .set_event_loop() - # (the unix DefaultEventLoopPolicy needs this call to attach -@@ -2755,10 +2751,8 @@ def test_get_event_loop_returns_running_loop2(self): - loop = asyncio.new_event_loop() - self.addCleanup(loop.close) - -- with self.assertWarns(DeprecationWarning) as cm: -- loop2 = asyncio.get_event_loop() -+ loop2 = asyncio.get_event_loop() - self.addCleanup(loop2.close) -- self.assertEqual(cm.filename, __file__) - asyncio.set_event_loop(None) - with self.assertRaisesRegex(RuntimeError, 'no current'): - asyncio.get_event_loop() -diff --git a/Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst b/Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst -new file mode 100644 -index 0000000000..c3b518ca85 ---- /dev/null -+++ b/Misc/NEWS.d/next/Library/2022-12-21-18-29-24.gh-issue-100160.isBmL5.rst -@@ -0,0 +1,2 @@ -+Remove any deprecation warnings in :func:`asyncio.get_event_loop`. They are -+deferred to Python 3.12. diff --git a/python3.11.spec b/python3.11.spec index ded2dde..5cbe656 100644 --- a/python3.11.spec +++ b/python3.11.spec @@ -13,11 +13,11 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well -%global general_version %{pybasever}.1 +%global general_version %{pybasever}.2 #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 4%{?dist} +Release: 1%{?dist} License: Python-2.0.1 @@ -323,16 +323,6 @@ Patch328: 00328-pyc-timestamp-invalidation-mode.patch # https://github.com/GrahamDumpleton/mod_wsgi/issues/730 Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch -# 00395 # 18ff37a92c507144edf32274b356dd1dd734cf07 -# GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output -Patch395: 00395-gh-100133-fix-asyncio-subprocess-losing-stderr-and-stdout-output.patch - -# 00396 # 4c775fbed65016fec5dfd66316559024d2af9135 -# gh-100160: Remove any deprecation warnings in asyncio.get_event_loop() -# -# Some deprecation warnings will reappear (in a slightly different form) in 3.12. -Patch396: 00396-gh-100160-remove-any-deprecation-warnings-in-asyncio-get_event_loop.patch - # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -1451,6 +1441,7 @@ CheckPython optimized %{dynload_dir}/_ctypes_test.%{SOABI_optimized}.so %{dynload_dir}/_testbuffer.%{SOABI_optimized}.so %{dynload_dir}/_testcapi.%{SOABI_optimized}.so +%{dynload_dir}/_testclinic.%{SOABI_optimized}.so %{dynload_dir}/_testimportmultiple.%{SOABI_optimized}.so %{dynload_dir}/_testinternalcapi.%{SOABI_optimized}.so %{dynload_dir}/_testmultiphase.%{SOABI_optimized}.so @@ -1579,6 +1570,7 @@ CheckPython optimized %{dynload_dir}/_ctypes_test.%{SOABI_debug}.so %{dynload_dir}/_testbuffer.%{SOABI_debug}.so %{dynload_dir}/_testcapi.%{SOABI_debug}.so +%{dynload_dir}/_testclinic.%{SOABI_debug}.so %{dynload_dir}/_testimportmultiple.%{SOABI_debug}.so %{dynload_dir}/_testinternalcapi.%{SOABI_debug}.so %{dynload_dir}/_testmultiphase.%{SOABI_debug}.so @@ -1609,6 +1601,9 @@ CheckPython optimized # ====================================================== %changelog +* Wed Feb 08 2023 Tomáš Hrnčiar - 3.11.2-1 +- Update to 3.11.2 + * Fri Jan 20 2023 Fedora Release Engineering - 3.11.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/sources b/sources index 327dc94..4ed0e1f 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (Python-3.11.1.tar.xz) = 5edd70c881e083c96199c60471f18f9ebc4c97a2d45dc66f89e16d7c3638d8a5d2cbf2e84b1be3d7f1178ce9f7fa4197884385c1ee3618ff66a538f872f318ed -SHA512 (Python-3.11.1.tar.xz.asc) = 81ed05c2adf38552bdc5ac761704f2720a646d56681a919a6bfa51f1a4b42cd14edb9c84d58664dbc8e7b561cd78d82ae6b10dda423e1fae543bc7fa4bf3f78e +SHA512 (Python-3.11.2.tar.xz) = 5684ec7eae2dce26facc54d448ccdb6901bbfa1cab03abbe8fd34e4268a2b701daa13df15903349492447035be78380d473389e8703b4e910a65b088d2462e8b +SHA512 (Python-3.11.2.tar.xz.asc) = 9d9d1c6dd6e56a916c6861cd0e7e623a165b0845bafe0acfcae27b4fe10a6b7015844e6b3f8deded26a763c935e32f565b2e12beb20c43fda16c11eba8d282a1 From 8c9b818bd00633d1ae0c6488a4476bd8063992e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Wed, 5 Apr 2023 13:51:34 +0200 Subject: [PATCH 6/6] Update to 3.11.3 --- python3.11.spec | 5 ++++- sources | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python3.11.spec b/python3.11.spec index 5cbe656..08e8af9 100644 --- a/python3.11.spec +++ b/python3.11.spec @@ -13,7 +13,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well -%global general_version %{pybasever}.2 +%global general_version %{pybasever}.3 #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} @@ -1601,6 +1601,9 @@ CheckPython optimized # ====================================================== %changelog +* Wed Apr 05 2023 Tomáš Hrnčiar - 3.11.3-1 +- Update to 3.11.3 + * Wed Feb 08 2023 Tomáš Hrnčiar - 3.11.2-1 - Update to 3.11.2 diff --git a/sources b/sources index 4ed0e1f..ecff347 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (Python-3.11.2.tar.xz) = 5684ec7eae2dce26facc54d448ccdb6901bbfa1cab03abbe8fd34e4268a2b701daa13df15903349492447035be78380d473389e8703b4e910a65b088d2462e8b -SHA512 (Python-3.11.2.tar.xz.asc) = 9d9d1c6dd6e56a916c6861cd0e7e623a165b0845bafe0acfcae27b4fe10a6b7015844e6b3f8deded26a763c935e32f565b2e12beb20c43fda16c11eba8d282a1 +SHA512 (Python-3.11.3.tar.xz) = a3bba4b69322a47bfeefe42ba0fd7331b5b67fd2ab41441e2219d16ef8c6f307f1a48977afd073c18cfd24ec6cb1bfe0c4bb4b273031eb524dc7e9fb5fbcc3b6 +SHA512 (Python-3.11.3.tar.xz.asc) = 34bfb6e74e2bbec15bf3f653e32a3d705961b5f724e3f4713cf9b6b530f9c9e7e94f5cf855798bdf9763235b97a60ec9ad554d24cdc793e21a0c39540b5818d8