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/04 01:00:36 UTC
[incubator-ponymail-foal] 01/02: Suppress deprecation warning ...
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 886427ba5998c4e926305d54ccbd9e1087230b8a
Author: Sebb <se...@apache.org>
AuthorDate: Fri Feb 4 01:00:04 2022 +0000
Suppress deprecation warning ...
... hopefully without causing a failure on 3.7-3.9
---
server/main.py | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/server/main.py b/server/main.py
index 5b1ae60..660761c 100644
--- a/server/main.py
+++ b/server/main.py
@@ -70,7 +70,6 @@ class Server(plugins.server.BaseServer):
print(
"==== Apache Pony Mail (Foal v/%s ~%s) starting... ====" % (PONYMAIL_FOAL_VERSION, PONYMAIL_SERVER_VERSION)
)
- self.args = args
# Load configuration
yml = yaml.safe_load(open(args.config))
self.config = plugins.configuration.Configuration(yml)
@@ -244,13 +243,13 @@ class Server(plugins.server.BaseServer):
await self.dbpool.get_nowait().client.close()
def run(self):
- if self.args.new_loop:
- # Does not work; GH test fails with: RuntimeError: Task .. got Future <Future pending> attached to a different loop
+ # get_event_loop is deprecated in 3.10, but the replacment new_event_loop
+ # does not seem to work properly in earlier versions
+ if sys.version_info.minor < 10:
+ loop = asyncio.get_event_loop()
+ else:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
- # revert to original (deprecated) code
- else:
- 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:
@@ -293,11 +292,5 @@ if __name__ == "__main__":
action='store_true',
help="Enable test endpoints",
)
- # temporary hack to allow testing alternate loop code on GH python versions
- parser.add_argument(
- "--new_loop",
- action='store_true',
- help="test new loop impl",
- )
cliargs = parser.parse_args()
Server(cliargs).run()