Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-qtconsole for openSUSE:Factory checked in at 2023-04-24 22:31:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-qtconsole (Old) and /work/SRC/openSUSE:Factory/.python-qtconsole.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-qtconsole" Mon Apr 24 22:31:26 2023 rev:28 rq:1082300 version:5.4.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-qtconsole/python-qtconsole.changes 2023-03-21 17:42:57.206239314 +0100 +++ /work/SRC/openSUSE:Factory/.python-qtconsole.new.1533/python-qtconsole.changes 2023-04-24 22:31:37.475657346 +0200 @@ -1,0 +2,7 @@ +Sun Apr 23 17:22:41 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Update to 5.4.2 + * Check if the iopub channel is not closed before flushing it + * Fix kernel autorestart after it's killed for Jupyter-client 8+ + +------------------------------------------------------------------- Old: ---- qtconsole-5.4.1.tar.gz New: ---- qtconsole-5.4.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-qtconsole.spec ++++++ --- /var/tmp/diff_new_pack.zvr2Wo/_old 2023-04-24 22:31:38.043660722 +0200 +++ /var/tmp/diff_new_pack.zvr2Wo/_new 2023-04-24 22:31:38.047660746 +0200 @@ -22,7 +22,7 @@ %bcond_with libalternatives %endif Name: python-qtconsole -Version: 5.4.1 +Version: 5.4.2 Release: 0 Summary: Jupyter Qt console License: BSD-3-Clause ++++++ qtconsole-5.4.1.tar.gz -> qtconsole-5.4.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/PKG-INFO new/qtconsole-5.4.2/PKG-INFO --- old/qtconsole-5.4.1/PKG-INFO 2023-03-11 21:43:33.672649100 +0100 +++ new/qtconsole-5.4.2/PKG-INFO 2023-04-02 23:18:07.629845400 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: qtconsole -Version: 5.4.1 +Version: 5.4.2 Summary: Jupyter Qt console Home-page: http://jupyter.org Author: Jupyter Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/docs/source/changelog.rst new/qtconsole-5.4.2/docs/source/changelog.rst --- old/qtconsole-5.4.1/docs/source/changelog.rst 2023-03-11 21:39:59.000000000 +0100 +++ new/qtconsole-5.4.2/docs/source/changelog.rst 2023-04-02 23:15:37.000000000 +0200 @@ -8,6 +8,14 @@ 5.4 ~~~ +5.4.2 +----- + +`5.4.2 on GitHub <https://github.com/jupyter/qtconsole/milestones/5.4.2>`__ + +* Check if the iopub channel is not closed before flushing it. +* Fix kernel autorestart after it's killed for Jupyter-client 8+. + 5.4.1 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/qtconsole/_version.py new/qtconsole-5.4.2/qtconsole/_version.py --- old/qtconsole-5.4.1/qtconsole/_version.py 2023-03-11 21:42:36.000000000 +0100 +++ new/qtconsole-5.4.2/qtconsole/_version.py 2023-04-02 23:17:22.000000000 +0200 @@ -1,2 +1,2 @@ -version_info = (5, 4, 1) +version_info = (5, 4, 2) __version__ = '.'.join(map(str, version_info)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/qtconsole/client.py new/qtconsole-5.4.2/qtconsole/client.py --- old/qtconsole-5.4.1/qtconsole/client.py 2021-04-07 20:40:30.000000000 +0200 +++ new/qtconsole-5.4.2/qtconsole/client.py 2023-03-30 17:34:17.000000000 +0200 @@ -1,28 +1,17 @@ """ Defines a KernelClient that provides signals and slots. """ -import atexit -import errno -from threading import Thread -import time - -import zmq -# import ZMQError in top-level namespace, to avoid ugly attribute-error messages -# during garbage collection of threads at exit: -from zmq import ZMQError -from zmq.eventloop import ioloop, zmqstream -from qtpy import QtCore - -# Local imports -from traitlets import Type, Instance +# Third-party imports from jupyter_client.channels import HBChannel -from jupyter_client import KernelClient -from jupyter_client.channels import InvalidPortNumber from jupyter_client.threaded import ThreadedKernelClient, ThreadedZMQSocketChannel +from qtpy import QtCore +from traitlets import Type +# Local imports from .kernel_mixins import QtKernelClientMixin from .util import SuperQObject + class QtHBChannel(SuperQObject, HBChannel): # A longer timeout than the base class time_to_dead = 3.0 @@ -36,11 +25,8 @@ # Emit the generic signal. self.kernel_died.emit(since_last_heartbeat) -from jupyter_client import protocol_version_info - -major_protocol_version = protocol_version_info[0] -class QtZMQSocketChannel(ThreadedZMQSocketChannel,SuperQObject): +class QtZMQSocketChannel(ThreadedZMQSocketChannel, SuperQObject): """A ZMQ socket emitting a Qt signal when a message is received.""" message_received = QtCore.Signal(object) @@ -49,7 +35,6 @@ """ QtCore.QCoreApplication.instance().processEvents() - def call_handlers(self, msg): """This method is called in the ioloop thread when a message arrives. @@ -60,11 +45,14 @@ # Emit the generic signal. self.message_received.emit(msg) + def closed(self): + """Check if the channel is closed.""" + return self.stream is None or self.stream.closed() + class QtKernelClient(QtKernelClientMixin, ThreadedKernelClient): """ A KernelClient that provides signals and slots. """ - iopub_channel_class = Type(QtZMQSocketChannel) shell_channel_class = Type(QtZMQSocketChannel) stdin_channel_class = Type(QtZMQSocketChannel) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/qtconsole/frontend_widget.py new/qtconsole-5.4.2/qtconsole/frontend_widget.py --- old/qtconsole-5.4.1/qtconsole/frontend_widget.py 2022-11-02 01:49:56.000000000 +0100 +++ new/qtconsole-5.4.2/qtconsole/frontend_widget.py 2023-03-30 17:34:17.000000000 +0200 @@ -465,7 +465,8 @@ if info.kind == 'user': # Make sure that all output from the SUB channel has been processed # before writing a new prompt. - self.kernel_client.iopub_channel.flush() + if not self.kernel_client.iopub_channel.closed(): + self.kernel_client.iopub_channel.flush() # Reset the ANSI style information to prevent bad text in stdout # from messing up our colors. We're not a true terminal so we're @@ -505,7 +506,8 @@ # Make sure that all output from the SUB channel has been processed # before entering readline mode. - self.kernel_client.iopub_channel.flush() + if not self.kernel_client.iopub_channel.closed(): + self.kernel_client.iopub_channel.flush() def callback(line): self._finalize_input_request() @@ -538,6 +540,12 @@ """ self.log.warning("kernel restarted") self._kernel_restarted_message(died=died) + + # This resets the autorestart counter so that the kernel can be + # auto-restarted before the next time it's polled to see if it's alive. + if self.kernel_manager: + self.kernel_manager.reset_autorestart_count() + self.reset() def _handle_inspect_reply(self, rep): @@ -831,8 +839,6 @@ """ # Calculate where the cursor should be *after* the change: position += added - - document = self._control.document() if position == self._get_cursor().position(): self._auto_call_tip() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/qtconsole/jupyter_widget.py new/qtconsole-5.4.2/qtconsole/jupyter_widget.py --- old/qtconsole-5.4.1/qtconsole/jupyter_widget.py 2021-11-14 19:48:23.000000000 +0100 +++ new/qtconsole-5.4.2/qtconsole/jupyter_widget.py 2023-03-28 23:52:03.000000000 +0200 @@ -7,12 +7,9 @@ # Distributed under the terms of the Modified BSD License. from collections import namedtuple -import os.path -import re from subprocess import Popen import sys import time -from textwrap import dedent from warnings import warn from qtpy import QtCore, QtGui @@ -287,7 +284,6 @@ if self.include_output(msg): self.flush_clearoutput() data = msg['content']['data'] - metadata = msg['content']['metadata'] # In the regular JupyterWidget, we simply print the plain text # representation. if 'text/plain' in data: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/qtconsole/manager.py new/qtconsole-5.4.2/qtconsole/manager.py --- old/qtconsole-5.4.1/qtconsole/manager.py 2021-03-17 02:07:09.000000000 +0100 +++ new/qtconsole-5.4.2/qtconsole/manager.py 2023-03-28 23:52:03.000000000 +0200 @@ -26,6 +26,9 @@ def poll(self): super().poll() + def reset_count(self): + self._restart_count = 0 + class QtKernelManager(KernelManager, QtKernelManagerMixin): """A KernelManager with Qt signals for restart""" @@ -61,6 +64,21 @@ if self._is_restarting: self.kernel_restarted.emit() self._is_restarting = False + + def reset_autorestart_count(self): + """Reset autorestart count.""" + if self._restarter: + self._restarter.reset_count() + + async def _async_post_start_kernel(self, **kw): + """ + This is necessary for Jupyter-client 8+ because `start_kernel` doesn't + call `post_start_kernel` directly. + """ + await super()._async_post_start_kernel(**kw) + if self._is_restarting: + self.kernel_restarted.emit() + self._is_restarting = False def _handle_kernel_restarting(self): """Kernel has died, and will be restarted.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/qtconsole/tests/test_00_console_widget.py new/qtconsole-5.4.2/qtconsole/tests/test_00_console_widget.py --- old/qtconsole-5.4.1/qtconsole/tests/test_00_console_widget.py 2022-11-02 01:49:56.000000000 +0100 +++ new/qtconsole-5.4.2/qtconsole/tests/test_00_console_widget.py 2023-03-28 23:52:03.000000000 +0200 @@ -1,3 +1,4 @@ +import os import unittest import sys @@ -259,6 +260,49 @@ assert output in control.toPlainText() +@flaky(max_runs=5) +@pytest.mark.skipif(os.name == 'nt', reason="no SIGTERM on Windows") +def test_restart_after_kill(qtconsole, qtbot): + """ + Test that the kernel correctly restarts after a kill. + """ + window = qtconsole.window + shell = window.active_frontend + control = shell._control + + def wait_for_restart(): + qtbot.waitUntil( + lambda: 'Kernel died, restarting' in control.toPlainText() + ) + + # Wait until the console is fully up + qtbot.waitUntil(lambda: shell._prompt_html is not None, + timeout=SHELL_TIMEOUT) + + # This checks that we are able to restart the kernel even after the number + # of consecutive auto-restarts is reached (which by default is five). + for _ in range(10): + # Clear console + with qtbot.waitSignal(shell.executed): + shell.execute('%clear') + qtbot.wait(500) + + # Run some code that kills the kernel + code = "import os, signal; os.kill(os.getpid(), signal.SIGTERM)" + shell.execute(code) + + # Check that the restart message is printed + qtbot.waitUntil( + lambda: 'Kernel died, restarting' in control.toPlainText() + ) + + # Check that a new prompt is available after the restart + qtbot.waitUntil( + lambda: control.toPlainText().splitlines()[-1] == 'In [1]: ' + ) + qtbot.wait(500) + + @pytest.mark.skipif(no_display, reason="Doesn't work without a display") class TestConsoleWidget(unittest.TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtconsole-5.4.1/qtconsole.egg-info/PKG-INFO new/qtconsole-5.4.2/qtconsole.egg-info/PKG-INFO --- old/qtconsole-5.4.1/qtconsole.egg-info/PKG-INFO 2023-03-11 21:43:33.000000000 +0100 +++ new/qtconsole-5.4.2/qtconsole.egg-info/PKG-INFO 2023-04-02 23:18:07.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: qtconsole -Version: 5.4.1 +Version: 5.4.2 Summary: Jupyter Qt console Home-page: http://jupyter.org Author: Jupyter Development Team