Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-nest-asyncio for 
openSUSE:Factory checked in at 2024-01-31 23:53:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-nest-asyncio (Old)
 and      /work/SRC/openSUSE:Factory/.python-nest-asyncio.new.1815 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-nest-asyncio"

Wed Jan 31 23:53:25 2024 rev:9 rq:1142841 version:1.6.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-nest-asyncio/python-nest-asyncio.changes  
2024-01-21 23:07:24.203421397 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-nest-asyncio.new.1815/python-nest-asyncio.changes
        2024-01-31 23:53:34.668616240 +0100
@@ -1,0 +2,7 @@
+Tue Jan 30 18:04:45 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 1.6.0:
+  * Pre-empt current task before running handle, allowing unpatched
+    tasks
+
+-------------------------------------------------------------------

Old:
----
  nest_asyncio-1.5.9.tar.gz

New:
----
  nest_asyncio-1.6.0.tar.gz

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

Other differences:
------------------
++++++ python-nest-asyncio.spec ++++++
--- /var/tmp/diff_new_pack.NfjPoK/_old  2024-01-31 23:53:35.932661845 +0100
+++ /var/tmp/diff_new_pack.NfjPoK/_new  2024-01-31 23:53:35.932661845 +0100
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-nest-asyncio
-Version:        1.5.9
+Version:        1.6.0
 Release:        0
 Summary:        Patch asyncio to allow nested event loops
 License:        BSD-2-Clause

++++++ nest_asyncio-1.5.9.tar.gz -> nest_asyncio-1.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nest_asyncio-1.5.9/PKG-INFO 
new/nest_asyncio-1.6.0/PKG-INFO
--- old/nest_asyncio-1.5.9/PKG-INFO     2024-01-15 15:01:12.687237300 +0100
+++ new/nest_asyncio-1.6.0/PKG-INFO     2024-01-21 15:25:16.197325700 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: nest_asyncio
-Version: 1.5.9
+Version: 1.6.0
 Summary: Patch asyncio to allow nested event loops
 Home-page: https://github.com/erdewit/nest_asyncio
 Author: Ewald R. de Wit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nest_asyncio-1.5.9/nest_asyncio.egg-info/PKG-INFO 
new/nest_asyncio-1.6.0/nest_asyncio.egg-info/PKG-INFO
--- old/nest_asyncio-1.5.9/nest_asyncio.egg-info/PKG-INFO       2024-01-15 
15:01:12.000000000 +0100
+++ new/nest_asyncio-1.6.0/nest_asyncio.egg-info/PKG-INFO       2024-01-21 
15:25:16.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: nest-asyncio
-Version: 1.5.9
+Version: 1.6.0
 Summary: Patch asyncio to allow nested event loops
 Home-page: https://github.com/erdewit/nest_asyncio
 Author: Ewald R. de Wit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nest_asyncio-1.5.9/nest_asyncio.py 
new/nest_asyncio-1.6.0/nest_asyncio.py
--- old/nest_asyncio-1.5.9/nest_asyncio.py      2024-01-15 14:55:26.000000000 
+0100
+++ new/nest_asyncio-1.6.0/nest_asyncio.py      2024-01-21 15:10:29.000000000 
+0100
@@ -13,7 +13,6 @@
     """Patch asyncio to make its event loop reentrant."""
     _patch_asyncio()
     _patch_policy()
-    _patch_task()
     _patch_tornado()
 
     loop = loop or asyncio.get_event_loop()
@@ -126,7 +125,17 @@
                 break
             handle = ready.popleft()
             if not handle._cancelled:
-                handle._run()
+                # preempt the current task so that that checks in
+                # Task.__step do not raise
+                curr_task = curr_tasks.pop(self, None)
+
+                try:
+                    handle._run()
+                finally:
+                    # restore the current task
+                    if curr_task is not None:
+                        curr_tasks[self] = curr_task
+
         handle = None
 
     @contextmanager
@@ -193,45 +202,11 @@
         os.name == 'nt' and issubclass(cls, asyncio.ProactorEventLoop))
     if sys.version_info < (3, 7, 0):
         cls._set_coroutine_origin_tracking = cls._set_coroutine_wrapper
+    curr_tasks = asyncio.tasks._current_tasks \
+        if sys.version_info >= (3, 7, 0) else asyncio.Task._current_tasks
     cls._nest_patched = True
 
 
-def _patch_task():
-    """Patch the Task's step and enter/leave methods to make it reentrant."""
-
-    def step(task, exc=None):
-        curr_task = curr_tasks.get(task._loop)
-        try:
-            step_orig(task, exc)
-        finally:
-            if curr_task is None:
-                curr_tasks.pop(task._loop, None)
-            else:
-                curr_tasks[task._loop] = curr_task
-
-    Task = asyncio.Task
-    if hasattr(Task, '_nest_patched'):
-        return
-    if sys.version_info >= (3, 7, 0):
-
-        def enter_task(loop, task):
-            curr_tasks[loop] = task
-
-        def leave_task(loop, task):
-            curr_tasks.pop(loop, None)
-
-        asyncio.tasks._enter_task = enter_task
-        asyncio.tasks._leave_task = leave_task
-        curr_tasks = asyncio.tasks._current_tasks
-        step_orig = Task._Task__step
-        Task._Task__step = step
-    else:
-        curr_tasks = Task._current_tasks
-        step_orig = Task._step
-        Task._step = step
-    Task._nest_patched = True
-
-
 def _patch_tornado():
     """
     If tornado is imported before nest_asyncio, make tornado aware of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nest_asyncio-1.5.9/setup.cfg 
new/nest_asyncio-1.6.0/setup.cfg
--- old/nest_asyncio-1.5.9/setup.cfg    2024-01-15 15:01:12.687237300 +0100
+++ new/nest_asyncio-1.6.0/setup.cfg    2024-01-21 15:25:16.198325600 +0100
@@ -1,6 +1,6 @@
 [metadata]
 name = nest_asyncio
-version = 1.5.9
+version = 1.6.0
 author = Ewald R. de Wit
 author_email = ewald.de....@gmail.com
 license = BSD

Reply via email to