[tor-commits] [stem] branch master updated: Python 3.11 compatibility fix for deprecated coroutine decorator
gitolite role
git at cupani.torproject.org
Thu Jan 26 23:47:10 UTC 2023
This is an automated email from the git hooks/post-receive script.
atagar pushed a commit to branch master
in repository stem.
The following commit(s) were added to refs/heads/master by this push:
new 89b0a288 Python 3.11 compatibility fix for deprecated coroutine decorator
89b0a288 is described below
commit 89b0a288fe9d012cc27a3f94c38f0e8f0f6f76cf
Author: Micah Elizabeth Scott <beth at torproject.org>
AuthorDate: Wed Jan 18 17:53:29 2023 -0800
Python 3.11 compatibility fix for deprecated coroutine decorator
The code to run __ainit__ constructors in the Synchronous mixin was
using the deprecated asyncio.coroutine() decorator, which was fully
removed in Python 3.11. Thankfully we can use the same approach for
ainit that this same class uses below for wrapping generators.
---
stem/util/asyncio.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/stem/util/asyncio.py b/stem/util/asyncio.py
index e677f13d..7dc7250d 100644
--- a/stem/util/asyncio.py
+++ b/stem/util/asyncio.py
@@ -92,7 +92,10 @@ class Synchronous(object):
setattr(self, name, functools.partial(self._run_async_method, name))
Synchronous.start(self)
- asyncio.run_coroutine_threadsafe(asyncio.coroutine(self.__ainit__)(), self._loop).result()
+
+ async def convert_ainit():
+ return self.__ainit__()
+ asyncio.run_coroutine_threadsafe(convert_ainit(), self._loop).result()
def __ainit__(self):
"""
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tor-commits
mailing list