Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-prompt_toolkit for openSUSE:Factory checked in at 2022-12-07 17:34:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-prompt_toolkit (Old) and /work/SRC/openSUSE:Factory/.python-prompt_toolkit.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-prompt_toolkit" Wed Dec 7 17:34:44 2022 rev:20 rq:1040748 version:3.0.33 Changes: -------- --- /work/SRC/openSUSE:Factory/python-prompt_toolkit/python-prompt_toolkit.changes 2022-11-12 17:40:33.977952656 +0100 +++ /work/SRC/openSUSE:Factory/.python-prompt_toolkit.new.1835/python-prompt_toolkit.changes 2022-12-07 17:36:02.528893004 +0100 @@ -1,0 +2,11 @@ +Tue Dec 6 04:28:29 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 3.0.33: + Fixes: + - Improve termination of `Application`. Don't suppress `CancelledError`. This + fixes a race condition when an `Application` gets cancelled while we're + waiting for the background tasks to complete. + - Fixed typehint for `OneStyleAndTextTuple`. + - Small bugfix in `CombinedRegistry`. Fixed missing `@property`. + +------------------------------------------------------------------- Old: ---- prompt_toolkit-3.0.32.tar.gz New: ---- prompt_toolkit-3.0.33.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-prompt_toolkit.spec ++++++ --- /var/tmp/diff_new_pack.dNBWGi/_old 2022-12-07 17:36:03.316897319 +0100 +++ /var/tmp/diff_new_pack.dNBWGi/_new 2022-12-07 17:36:03.320897341 +0100 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-prompt_toolkit -Version: 3.0.32 +Version: 3.0.33 Release: 0 Summary: Library for building interactive command lines in Python License: BSD-3-Clause ++++++ prompt_toolkit-3.0.32.tar.gz -> prompt_toolkit-3.0.33.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prompt_toolkit-3.0.32/CHANGELOG new/prompt_toolkit-3.0.33/CHANGELOG --- old/prompt_toolkit-3.0.32/CHANGELOG 2022-11-03 17:29:06.000000000 +0100 +++ new/prompt_toolkit-3.0.33/CHANGELOG 2022-11-21 14:39:57.000000000 +0100 @@ -1,6 +1,17 @@ CHANGELOG ========= +3.0.33: 2022-11-21 +------------------ + +Fixes: +- Improve termination of `Application`. Don't suppress `CancelledError`. This + fixes a race condition when an `Application` gets cancelled while we're + waiting for the background tasks to complete. +- Fixed typehint for `OneStyleAndTextTuple`. +- Small bugfix in `CombinedRegistry`. Fixed missing `@property`. + + 3.0.32: 2022-11-03 ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prompt_toolkit-3.0.32/PKG-INFO new/prompt_toolkit-3.0.33/PKG-INFO --- old/prompt_toolkit-3.0.32/PKG-INFO 2022-11-03 17:32:01.266258000 +0100 +++ new/prompt_toolkit-3.0.33/PKG-INFO 2022-11-21 14:41:26.350330600 +0100 @@ -1,11 +1,9 @@ Metadata-Version: 2.1 Name: prompt_toolkit -Version: 3.0.32 +Version: 3.0.33 Summary: Library for building powerful interactive command lines in Python Home-page: https://github.com/prompt-toolkit/python-prompt-toolkit Author: Jonathan Slenders -License: UNKNOWN -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License @@ -181,5 +179,3 @@ .. |Codecov| image:: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/branch/master/graphs/badge.svg?style=flat :target: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/ - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prompt_toolkit-3.0.32/src/prompt_toolkit/__init__.py new/prompt_toolkit-3.0.33/src/prompt_toolkit/__init__.py --- old/prompt_toolkit-3.0.32/src/prompt_toolkit/__init__.py 2022-11-03 17:29:36.000000000 +0100 +++ new/prompt_toolkit-3.0.33/src/prompt_toolkit/__init__.py 2022-11-21 14:40:23.000000000 +0100 @@ -18,7 +18,7 @@ from .shortcuts import PromptSession, print_formatted_text, prompt # Don't forget to update in `docs/conf.py`! -__version__ = "3.0.32" +__version__ = "3.0.33" # Version tuple. VERSION = tuple(__version__.split(".")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prompt_toolkit-3.0.32/src/prompt_toolkit/application/application.py new/prompt_toolkit-3.0.33/src/prompt_toolkit/application/application.py --- old/prompt_toolkit-3.0.32/src/prompt_toolkit/application/application.py 2022-09-02 10:53:41.000000000 +0200 +++ new/prompt_toolkit-3.0.33/src/prompt_toolkit/application/application.py 2022-11-21 14:36:18.000000000 +0100 @@ -7,7 +7,6 @@ import time from asyncio import ( AbstractEventLoop, - CancelledError, Future, Task, ensure_future, @@ -32,6 +31,7 @@ Iterator, List, Optional, + Set, Tuple, Type, TypeVar, @@ -433,7 +433,7 @@ self.exit_style = "" - self.background_tasks: List[Task[None]] = [] + self._background_tasks: Set[Task[None]] = set() self.renderer.reset() self.key_processor.reset() @@ -1066,32 +1066,75 @@ the `Application` terminates, unfinished background tasks will be cancelled. - If asyncio had nurseries like Trio, we would create a nursery in - `Application.run_async`, and run the given coroutine in that nursery. + Given that we still support Python versions before 3.11, we can't use + task groups (and exception groups), because of that, these background + tasks are not allowed to raise exceptions. If they do, we'll call the + default exception handler from the event loop. + + If at some point, we have Python 3.11 as the minimum supported Python + version, then we can use a `TaskGroup` (with the lifetime of + `Application.run_async()`, and run run the background tasks in there. - Not threadsafe. + This is not threadsafe. """ task: asyncio.Task[None] = get_event_loop().create_task(coroutine) - self.background_tasks.append(task) + self._background_tasks.add(task) + + task.add_done_callback(self._on_background_task_done) return task + def _on_background_task_done(self, task: "asyncio.Task[None]") -> None: + """ + Called when a background task completes. Remove it from + `_background_tasks`, and handle exceptions if any. + """ + self._background_tasks.discard(task) + + if task.cancelled(): + return + + exc = task.exception() + if exc is not None: + get_event_loop().call_exception_handler( + { + "message": f"prompt_toolkit.Application background task {task!r} " + "raised an unexpected exception.", + "exception": exc, + "task": task, + } + ) + async def cancel_and_wait_for_background_tasks(self) -> None: """ - Cancel all background tasks, and wait for the cancellation to be done. + Cancel all background tasks, and wait for the cancellation to complete. If any of the background tasks raised an exception, this will also propagate the exception. (If we had nurseries like Trio, this would be the `__aexit__` of a nursery.) """ - for task in self.background_tasks: + for task in self._background_tasks: task.cancel() - for task in self.background_tasks: - try: - await task - except CancelledError: - pass + # Wait until the cancellation of the background tasks completes. + # `asyncio.wait()` does not propagate exceptions raised within any of + # these tasks, which is what we want. Otherwise, we can't distinguish + # between a `CancelledError` raised in this task because it got + # cancelled, and a `CancelledError` raised on this `await` checkpoint, + # because *we* got cancelled during the teardown of the application. + # (If we get cancelled here, then it's important to not suppress the + # `CancelledError`, and have it propagate.) + # NOTE: Currently, if we get cancelled at this point then we can't wait + # for the cancellation to complete (in the future, we should be + # using anyio or Python's 3.11 TaskGroup.) + # Also, if we had exception groups, we could propagate an + # `ExceptionGroup` if something went wrong here. Right now, we + # don't propagate exceptions, but have them printed in + # `_on_background_task_done`. + if len(self._background_tasks) > 0: + await asyncio.wait( + self._background_tasks, timeout=None, return_when=asyncio.ALL_COMPLETED + ) async def _poll_output_size(self) -> None: """ @@ -1326,6 +1369,7 @@ KeyBindings object.""" raise NotImplementedError + @property def bindings(self) -> List[Binding]: """Not needed - this object is not going to be wrapped in another KeyBindings object.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prompt_toolkit-3.0.32/src/prompt_toolkit/contrib/telnet/server.py new/prompt_toolkit-3.0.33/src/prompt_toolkit/contrib/telnet/server.py --- old/prompt_toolkit-3.0.32/src/prompt_toolkit/contrib/telnet/server.py 2022-09-02 10:53:41.000000000 +0200 +++ new/prompt_toolkit-3.0.33/src/prompt_toolkit/contrib/telnet/server.py 2022-11-21 14:36:18.000000000 +0100 @@ -323,11 +323,14 @@ for t in self._application_tasks: t.cancel() - for t in self._application_tasks: - try: - await t - except asyncio.CancelledError: - logger.debug("Task %s cancelled", str(t)) + # (This is similar to + # `Application.cancel_and_wait_for_background_tasks`. We wait for the + # background tasks to complete, but don't propagate exceptions, because + # we can't use `ExceptionGroup` yet.) + if len(self._application_tasks) > 0: + await asyncio.wait( + self._application_tasks, timeout=None, return_when=asyncio.ALL_COMPLETED + ) def _accept(self) -> None: """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prompt_toolkit-3.0.32/src/prompt_toolkit/formatted_text/base.py new/prompt_toolkit-3.0.33/src/prompt_toolkit/formatted_text/base.py --- old/prompt_toolkit-3.0.32/src/prompt_toolkit/formatted_text/base.py 2022-09-01 17:02:15.000000000 +0200 +++ new/prompt_toolkit-3.0.33/src/prompt_toolkit/formatted_text/base.py 2022-11-21 14:36:18.000000000 +0100 @@ -5,6 +5,8 @@ if TYPE_CHECKING: from typing_extensions import Protocol + from prompt_toolkit.key_binding.key_bindings import NotImplementedOrNone + __all__ = [ "OneStyleAndTextTuple", "StyleAndTextTuples", @@ -18,7 +20,7 @@ ] OneStyleAndTextTuple = Union[ - Tuple[str, str], Tuple[str, str, Callable[[MouseEvent], None]] + Tuple[str, str], Tuple[str, str, Callable[[MouseEvent], "NotImplementedOrNone"]] ] # List of (style, text) tuples. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prompt_toolkit-3.0.32/src/prompt_toolkit.egg-info/PKG-INFO new/prompt_toolkit-3.0.33/src/prompt_toolkit.egg-info/PKG-INFO --- old/prompt_toolkit-3.0.32/src/prompt_toolkit.egg-info/PKG-INFO 2022-11-03 17:32:01.000000000 +0100 +++ new/prompt_toolkit-3.0.33/src/prompt_toolkit.egg-info/PKG-INFO 2022-11-21 14:41:26.000000000 +0100 @@ -1,11 +1,9 @@ Metadata-Version: 2.1 Name: prompt-toolkit -Version: 3.0.32 +Version: 3.0.33 Summary: Library for building powerful interactive command lines in Python Home-page: https://github.com/prompt-toolkit/python-prompt-toolkit Author: Jonathan Slenders -License: UNKNOWN -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License @@ -181,5 +179,3 @@ .. |Codecov| image:: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/branch/master/graphs/badge.svg?style=flat :target: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/ - -