You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2022/02/03 23:48:03 UTC

[incubator-ponymail-foal] 01/02: Fix for deprecation does not work on GitHub

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit e8f497913581cefe72c79e6d4a5118b6c7155842
Author: Sebb <se...@apache.org>
AuthorDate: Thu Feb 3 23:47:27 2022 +0000

    Fix for deprecation does not work on GitHub
    
    Revert for now
---
 server/main.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/main.py b/server/main.py
index b4d1340..3c804bd 100644
--- a/server/main.py
+++ b/server/main.py
@@ -243,8 +243,11 @@ class Server(plugins.server.BaseServer):
             await self.dbpool.get_nowait().client.close()
 
     def run(self):
-        loop = asyncio.new_event_loop()
-        asyncio.set_event_loop(loop)
+        # Does not work; GH test fails with: RuntimeError: Task .. got Future <Future pending> attached to a different loop
+        # loop = asyncio.new_event_loop()
+        # asyncio.set_event_loop(loop)
+        # revert to original (deprecated) code
+        loop = asyncio.get_event_loop() # This needs to be replaced, as it will fail in Python 3.11
         try:
             loop.run_until_complete(self.server_loop())
         except KeyboardInterrupt:

Re: [incubator-ponymail-foal] 01/02: Fix for deprecation does not work on GitHub

Posted by Daniel Gruno <hu...@apache.org>.
If there is a version discrepancy in how asyncio works, can we use 
sys.version_info.minor to work around it? something like:

if sys.version_info.minor < 11:
     foo()
else:
     bar()

On 04/02/2022 00.48, sebb@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> sebb pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
> 
> commit e8f497913581cefe72c79e6d4a5118b6c7155842
> Author: Sebb <se...@apache.org>
> AuthorDate: Thu Feb 3 23:47:27 2022 +0000
> 
>      Fix for deprecation does not work on GitHub
>      
>      Revert for now
> ---
>   server/main.py | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/server/main.py b/server/main.py
> index b4d1340..3c804bd 100644
> --- a/server/main.py
> +++ b/server/main.py
> @@ -243,8 +243,11 @@ class Server(plugins.server.BaseServer):
>               await self.dbpool.get_nowait().client.close()
>   
>       def run(self):
> -        loop = asyncio.new_event_loop()
> -        asyncio.set_event_loop(loop)
> +        # Does not work; GH test fails with: RuntimeError: Task .. got Future <Future pending> attached to a different loop
> +        # loop = asyncio.new_event_loop()
> +        # asyncio.set_event_loop(loop)
> +        # revert to original (deprecated) code
> +        loop = asyncio.get_event_loop() # This needs to be replaced, as it will fail in Python 3.11
>           try:
>               loop.run_until_complete(self.server_loop())
>           except KeyboardInterrupt: