Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-gevent for openSUSE:Factory 
checked in at 2026-11-24 12:22:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-gevent (Old)
 and      /work/SRC/openSUSE:Factory/.python-gevent.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-gevent"

Tue Nov 24 12:22:48 2026 rev:64 rq:1399752 version:26.9.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-gevent/python-gevent.changes      
2026-08-22 21:35:40.127181953 +0200
+++ /work/SRC/openSUSE:Factory/.python-gevent.new.1340718/python-gevent.changes 
2026-11-24 12:23:16.367427688 +0100
@@ -1,0 +2,24 @@
+Sun Nov 22 11:34:36 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 26.9.0:
+  * Fix :class:`gevent.event.AsyncResult` re-raising an exception
+    with a traceback that kept growing by the frames of every
+    previous :meth:`~gevent.event.AsyncResult.get` call, instead
+    of starting fresh from the traceback captured when
+    :meth:`~gevent.event.AsyncResult.set_exception` was called.
+    See :issue:`1946`.
+  * Make gevent's file objects properly report the full mode
+    string. Previously a 'b' or 't' suffix could be missing. See
+    :issue:`2039`.
+  * ThreadPool workers no longer call the profile and trace
+    setters when no hooks are configured. This matches
+    threading.Thread and avoids unnecessary PEP 578 audit events
+    and thread coordination. See :issue:`2206`.
+  * An exception while preparing a ThreadPool worker to run a
+    task, such as an audit hook rejecting sys.setprofile(), no
+    longer leaves the caller blocked or leaks a pool slot. The
+    exception is raised in the greenlet waiting on apply() or
+    spawn(), and the failed worker is replaced if other tasks are
+    waiting. See :issue:`2207`.
+
+-------------------------------------------------------------------

Old:
----
  gevent-26.8.0.tar.gz

New:
----
  gevent-26.9.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-gevent.spec ++++++
--- /var/tmp/diff_new_pack.HHlYg3/_old  2026-11-24 12:23:17.825489465 +0100
+++ /var/tmp/diff_new_pack.HHlYg3/_new  2026-11-24 12:23:17.827489550 +0100
@@ -26,7 +26,7 @@
 %bcond_with colortest
 %{?sle15_python_module_pythons}
 Name:           python-gevent
-Version:        26.8.0
+Version:        26.9.0
 Release:        0
 Summary:        Python network library that uses greenlet and libevent
 License:        MIT
@@ -36,8 +36,8 @@
 Source100:      %{name}-rpmlintrc
 # PATCH-FEATURE-OPENSUSE gevent-opensuse-nocolor-tests.patch 
[email protected] -- Avoid colorization of test output in obs runners
 Patch2:         gevent-opensuse-nocolor-tests.patch
-BuildRequires:  %{python_module Cython >= 3}
-BuildRequires:  %{python_module cffi >= 1.17.1}
+BuildRequires:  %{python_module Cython >= 3.2.4}
+BuildRequires:  %{python_module cffi >= 2.1.1}
 BuildRequires:  %{python_module devel >= 3.8}
 BuildRequires:  %{python_module greenlet >= 3.2.2}
 BuildRequires:  %{python_module pip}
@@ -57,11 +57,11 @@
 BuildRequires:  pkgconfig(libev)
 %endif
 %if 0%{?suse_version} || 0%{?fedora_version} ||  0%{?rhel} >= 8
-Recommends:     python-cffi >= 1.17.1
+Recommends:     python-cffi >= 2.1.1
 Recommends:     python-dnspython
 Recommends:     python-psutil
 %else
-Requires:       python-cffi >= 1.17.1
+Requires:       python-cffi >= 2.1.1
 Requires:       python-dnspython
 Requires:       python-psutil
 %endif

++++++ gevent-26.8.0.tar.gz -> gevent-26.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/CHANGES.rst 
new/gevent-26.9.0/CHANGES.rst
--- old/gevent-26.8.0/CHANGES.rst       2026-08-10 18:54:02.000000000 +0200
+++ new/gevent-26.9.0/CHANGES.rst       2026-09-16 18:11:52.000000000 +0200
@@ -6,6 +6,34 @@
 
 .. towncrier release notes start
 
+26.9.0 (2026-09-16)
+===================
+
+
+Bugfixes
+--------
+
+- Fix :class:`gevent.event.AsyncResult` re-raising an exception with a
+  traceback that kept growing by the frames of every previous
+  :meth:`~gevent.event.AsyncResult.get` call, instead of starting fresh
+  from the traceback captured when 
:meth:`~gevent.event.AsyncResult.set_exception`
+  was called.
+  See :issue:`1946`.
+- Make gevent's file objects properly report the full mode string.
+  Previously a 'b' or 't' suffix could be missing.
+  See :issue:`2039`.
+- ThreadPool workers no longer call the profile and trace setters when no
+  hooks are configured. This matches ``threading.Thread`` and avoids
+  unnecessary PEP 578 audit events and thread coordination.
+  See :issue:`2206`.
+- An exception while preparing a ThreadPool worker to run a task, such as
+  an audit hook rejecting ``sys.setprofile()``, no longer leaves the caller
+  blocked or leaks a pool slot. The exception is raised in the greenlet
+  waiting on ``apply()`` or ``spawn()``, and the failed worker is replaced
+  if other tasks are waiting.
+  See :issue:`2207`.
+
+
 26.8.0 (2026-08-10)
 ===================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/src/gevent/__init__.py 
new/gevent-26.9.0/src/gevent/__init__.py
--- old/gevent-26.8.0/src/gevent/__init__.py    2026-08-10 18:54:02.000000000 
+0200
+++ new/gevent-26.9.0/src/gevent/__init__.py    2026-09-16 18:11:52.000000000 
+0200
@@ -27,7 +27,7 @@
 #: Use ``pkg_resources.parse_version(__version__)`` or
 #: ``packaging.version.Version(__version__)`` to get a machine-usable
 #: value.
-__version__ = '26.8.0'
+__version__ = '26.9.0'
 
 
 __all__ = [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/src/gevent/_compat.py 
new/gevent-26.9.0/src/gevent/_compat.py
--- old/gevent-26.8.0/src/gevent/_compat.py     2026-08-10 18:54:02.000000000 
+0200
+++ new/gevent-26.9.0/src/gevent/_compat.py     2026-09-16 18:11:52.000000000 
+0200
@@ -84,7 +84,7 @@
 ## Exceptions
 
 def reraise(t, value, tb=None): # pylint:disable=unused-argument
-    if value.__traceback__ is not tb and tb is not None:
+    if value.__traceback__ is not tb:
         raise value.with_traceback(tb)
     raise value
 def exc_clear():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/src/gevent/_fileobjectposix.py 
new/gevent-26.9.0/src/gevent/_fileobjectposix.py
--- old/gevent-26.8.0/src/gevent/_fileobjectposix.py    2026-08-10 
18:54:02.000000000 +0200
+++ new/gevent-26.9.0/src/gevent/_fileobjectposix.py    2026-09-16 
18:11:52.000000000 +0200
@@ -45,7 +45,11 @@
         self._closefd = closefd
         self._fileno = fileno
         self.name = fileno
-        self.mode = open_descriptor.fileio_mode
+        # Use the full mode (including the 't'/'b' suffix), matching what
+        # io.FileIO itself reports; open_descriptor.fileio_mode is the
+        # stripped-down string meant only for constructing the raw FileIO,
+        # not for user-facing introspection.
+        self.mode = open_descriptor.mode
         make_nonblocking(fileno)
         readable = open_descriptor.can_read
         writable = open_descriptor.can_write
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/src/gevent/tests/test__event.py 
new/gevent-26.9.0/src/gevent/tests/test__event.py
--- old/gevent-26.8.0/src/gevent/tests/test__event.py   2026-08-10 
18:54:02.000000000 +0200
+++ new/gevent-26.9.0/src/gevent/tests/test__event.py   2026-09-16 
18:11:52.000000000 +0200
@@ -1,3 +1,4 @@
+import traceback
 import weakref
 
 import gevent
@@ -106,6 +107,28 @@
         gevent.sleep(0)
         self.assertEqual(log, [('caught', obj)])
 
+    def test_get_repeated_does_not_accumulate_traceback(self):
+        # https://github.com/gevent/gevent/issues/1946
+        # Getting an AsyncResult that holds an exception, repeatedly,
+        # used to keep extending the exception's traceback with the
+        # frames of every previous ``get()`` call instead of starting
+        # fresh from the traceback captured at ``set_exception`` time.
+        ar = AsyncResult()
+        ar.set_exception(MyException())
+
+        tb_lengths = []
+        for _ in range(3):
+            try:
+                ar.get()
+            except MyException as exc:
+                # Read the traceback length here, inside the ``except``
+                # clause: ``self.assertRaises`` strips ``__traceback__``
+                # from the exception it stores to avoid a reference
+                # cycle, which would hide this regression.
+                tb_lengths.append(len(traceback.extract_tb(exc.__traceback__)))
+
+        self.assertEqual(tb_lengths, [tb_lengths[0]] * len(tb_lengths))
+
     def test_set(self):
         event1 = AsyncResult()
         timer_exc = MyException('interrupted')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/src/gevent/tests/test__fileobject.py 
new/gevent-26.9.0/src/gevent/tests/test__fileobject.py
--- old/gevent-26.8.0/src/gevent/tests/test__fileobject.py      2026-08-10 
18:54:02.000000000 +0200
+++ new/gevent-26.9.0/src/gevent/tests/test__fileobject.py      2026-09-16 
18:11:52.000000000 +0200
@@ -469,6 +469,19 @@
     def _getTargetClass(self):
         return fileobject.FileObjectPosix
 
+    def test_mode_includes_binary_suffix(self):
+        # https://github.com/gevent/gevent/issues/2039
+        # Constructing with an explicit 'wb'/'rb' mode should report
+        # that full mode back, matching what io.FileIO does, instead of
+        # silently dropping the 'b' and reporting just 'w'/'r'.
+        r, w = self._pipe()
+
+        writer = self._makeOne(w, 'wb', close=False)
+        self.assertEqual(writer.mode, 'wb')
+
+        reader = self._makeOne(r, 'rb', close=False)
+        self.assertEqual(reader.mode, 'rb')
+
     def test_seek_raises_ioerror(self):
         # https://github.com/gevent/gevent/issues/1323
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/src/gevent/tests/test__threadpool.py 
new/gevent-26.9.0/src/gevent/tests/test__threadpool.py
--- old/gevent-26.8.0/src/gevent/tests/test__threadpool.py      2026-08-10 
18:54:02.000000000 +0200
+++ new/gevent-26.9.0/src/gevent/tests/test__threadpool.py      2026-09-16 
18:11:52.000000000 +0200
@@ -721,6 +721,103 @@
         self.assertIsNotNone(tr.receiver)
 
 
+_setup_failure_script = r"""
+import sys
+import threading
+
+# Workers only call sys.setprofile() when a profile hook is configured
+# (see issue 2206).
+threading.setprofile(lambda *args: None)
+
+from gevent.threadpool import ThreadPool
+
+# Wait until gevent has been imported to install the audit hook, since
+# it runs for every audited event for the rest of the process.
+def audit(event, args):
+    if event == 'sys.setprofile':
+        raise RuntimeError('setprofile rejected by audit hook')
+sys.addaudithook(audit)
+
+try:
+    sys.setprofile(None)
+except RuntimeError:
+    pass
+else:
+    sys.exit(4)
+
+pool = ThreadPool(2)
+try:
+    pool.apply(len, ('x',))
+except RuntimeError:
+    sys.exit(0)
+raise AssertionError('pool.apply() did not raise')
+"""
+
+
+class TestBeforeRunTaskFailure(TestCase):
+    # If _before_run_task raises, the caller should get the exception and
+    # the pool should release the slot reserved by spawn().
+    # https://github.com/gevent/gevent/issues/2207
+
+    error_fatal = False
+
+    def setUp(self):
+        super().setUp()
+        # Make task setup fail until the test opts out.
+        self.fail_setup = True
+
+    def _make_failing_pool(self):
+        import io
+        test = self
+
+        class Pool(ThreadPool):
+            class _WorkerGreenlet(ThreadPool._WorkerGreenlet):
+                def __init__(self, threadpool):
+                    ThreadPool._WorkerGreenlet.__init__(self, threadpool)
+                    # Suppress the expected "Failed to run worker thread"
+                    # message when setup fails.
+                    self._stderr = io.StringIO()
+
+                def _before_run_task(self, *args):
+                    if test.fail_setup:
+                        raise ExpectedException
+                    ThreadPool._WorkerGreenlet._before_run_task(self, *args)
+
+        self.ClassUnderTest = Pool
+        return self._makeOne(2)
+
+    def test_caller_gets_exception_and_slot_is_released(self):
+        # Before the fix, each failed task leaked a pool slot. Once every
+        # slot was gone, the next spawn() blocked forever.
+        pool = self._make_failing_pool()
+        for _ in range(pool.maxsize + 1):
+            with self.assertRaises(ExpectedException):
+                pool.apply(lambda: 1701)
+
+        self.fail_setup = False
+        self.assertEqual(pool.apply(lambda: 1701), 1701)
+
+    def test_queued_task_runs_after_all_workers_fail(self):
+        # Queued tasks should not need another spawn() call to replace the
+        # failed workers.
+        pool = self._make_failing_pool()
+        results = [pool.spawn(lambda: 1701) for _ in range(pool.maxsize + 1)]
+        for result in results:
+            with self.assertRaises(ExpectedException):
+                result.get()
+        pool.join()
+
+    @greentest.ignores_leakcheck
+    def test_audit_hook_rejection_does_not_hang(self):
+        # Audit hooks cannot be removed, so keep this one in a subprocess.
+        import subprocess
+        import sys
+        rc = subprocess.call([sys.executable, '-c', _setup_failure_script], 
timeout=30)
+        if rc == 4:
+            self.skipTest('audit events not enforced on this interpreter')
+        self.assertEqual(rc, 0)
+
+
 class TestWorkerProfileAndTrace(TestCase):
     # Worker threads should execute the test and trace functions.
     # (When running the user code.)
@@ -819,6 +916,83 @@
     def test_trace_called_in_task(self):
         self._test_func_called_in_task('trace')
 
+    def _make_recording_pool(self):
+        class RecordingSys(object):
+            def __init__(self):
+                self.profile = None
+                self.trace = None
+                self.setter_calls = []
+
+            def getprofile(self):
+                return self.profile
+
+            def gettrace(self):
+                return self.trace
+
+            def setprofile(self, value):
+                self.setter_calls.append(('setprofile', value))
+                self.profile = value
+
+            def settrace(self, value):
+                self.setter_calls.append(('settrace', value))
+                self.trace = value
+
+        recording_sys = RecordingSys()
+
+        def no_hook():
+            return None
+
+        class Pool(ThreadPool):
+            class _WorkerGreenlet(ThreadPool._WorkerGreenlet):
+                # pylint:disable=signature-differs
+                def _before_run_task(self, *args):
+                    ThreadPool._WorkerGreenlet._before_run_task(
+                        self, *args,
+                        _sys=recording_sys,
+                        _get_thread_profile=no_hook,
+                        _get_thread_trace=no_hook)
+
+                def _after_run_task(self, *args):
+                    ThreadPool._WorkerGreenlet._after_run_task(
+                        self, *args, _sys=recording_sys)
+
+        self.ClassUnderTest = Pool
+
+        pool = self._makeOne(1, create_all_worker_threads=True)
+        return pool, recording_sys
+
+    def test_setters_not_called_without_hooks(self):
+        # The setters emit audit events even when passed None.
+        # https://github.com/gevent/gevent/issues/2206
+        pool, recording_sys = self._make_recording_pool()
+        res = pool.apply(lambda: 1701)
+        pool.kill()
+
+        self.assertEqual(res, 1701)
+        self.assertEqual(recording_sys.setter_calls, [])
+
+    def test_hooks_set_by_task_are_cleared(self):
+        pool, recording_sys = self._make_recording_pool()
+        profile = object()
+        trace = object()
+
+        def task():
+            recording_sys.setprofile(profile)
+            recording_sys.settrace(trace)
+
+        pool.apply(task)
+        # The clearing calls happen on the worker thread after apply()
+        # has returned; kill() is what makes them visible here (see the
+        # memory-consistency note in _test_func_called_in_task).
+        pool.kill()
+
+        self.assertEqual(recording_sys.setter_calls, [
+            ('setprofile', profile),
+            ('settrace', trace),
+            ('setprofile', None),
+            ('settrace', None),
+        ])
+
 
 
 if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gevent-26.8.0/src/gevent/threadpool.py 
new/gevent-26.9.0/src/gevent/threadpool.py
--- old/gevent-26.8.0/src/gevent/threadpool.py  2026-08-10 18:54:02.000000000 
+0200
+++ new/gevent-26.9.0/src/gevent/threadpool.py  2026-09-16 18:11:52.000000000 
+0200
@@ -99,6 +99,7 @@
         self._task_queue = threadpool.task_queue # type:gevent._threading.Queue
         self._task_queue_cookie = self._task_queue.allocate_cookie()
         self._unregister_worker = threadpool._unregister_worker
+        self._on_worker_exit = threadpool._on_worker_exit
         self._idle_task_timeout = threadpool._idle_task_timeout
 
         threadpool._register_worker(self)
@@ -159,16 +160,34 @@
                          _get_thread_profile=_get_thread_profile,
                          _get_thread_trace=_get_thread_trace):
         # pylint:disable=unused-argument
-        _sys.setprofile(_get_thread_profile())
-        _sys.settrace(_get_thread_trace())
+        # Hooks can change during a worker's lifetime, so read them for
+        # each task. Like threading.Thread, skip setters for missing hooks.
+        profile = _get_thread_profile()
+        if profile is not None:
+            _sys.setprofile(profile)
+        trace = _get_thread_trace()
+        if trace is not None:
+            _sys.settrace(trace)
 
     def _after_run_task(self, func, args, kwargs, thread_result, _sys=sys):
         # pylint:disable=unused-argument
-        _sys.setprofile(None)
-        _sys.settrace(None)
+        # Clear hooks installed here or by the task. A failed clear kills
+        # the worker, whose replacement starts with clean hooks.
+        if _sys.getprofile() is not None:
+            _sys.setprofile(None)
+        if _sys.gettrace() is not None:
+            _sys.settrace(None)
 
     def __run_task(self, func, args, kwargs, thread_result):
-        self._before_run_task(func, args, kwargs, thread_result)
+        try:
+            self._before_run_task(func, args, kwargs, thread_result)
+        except: # pylint:disable=bare-except
+            # Pass the error back to the caller so it doesn't wait forever
+            # and the pool can release the slot reserved by spawn(). Don't
+            # try to clean up a partially installed hook; let the worker exit
+            # so its replacement starts with a clean slate.
+            thread_result.handle_error((self, func), self._exc_info())
+            raise
         try:
             thread_result.set(func(*args, **kwargs))
         except: # pylint:disable=bare-except
@@ -187,6 +206,8 @@
         run_task = self.__run_task
         task_queue_done = self._task_queue.task_done
         idle_task_timeout = self._idle_task_timeout
+        on_worker_exit = self._on_worker_exit
+        stop_requested = False
         try: # pylint:disable=too-many-nested-blocks
             while 1: # tiny bit faster than True on Py2
                 fixup_hub_before_block()
@@ -201,6 +222,9 @@
                     return
                 try:
                     if task is None:
+                        # The pool expects this worker to exit, so it does
+                        # not need a replacement.
+                        stop_requested = True
                         return
 
                     run_task(*task)
@@ -221,6 +245,8 @@
             # Re-check for the hub in case the task created it but then
             # failed.
             self.cleanup(self._get_hub_if_exists())
+            if not stop_requested:
+                on_worker_exit()
 
     def cleanup(self, hub_of_worker):
         if self._hub is not None:
@@ -350,6 +376,12 @@
     def _unregister_worker(self, worker):
         self._worker_greenlets.discard(worker)
 
+    def _on_worker_exit(self):
+        # If tasks are still waiting, ask the hub to replace this worker;
+        # adjust() is not safe to call from the worker thread.
+        if self.task_queue.unfinished_tasks:
+            self.hub.loop.run_callback_threadsafe(self.adjust)
+
     def _set_maxsize(self, maxsize):
         if not isinstance(maxsize, integer_types):
             raise TypeError('maxsize must be integer: %r' % (maxsize, ))

Reply via email to