From f7a44783c0437a5962319ba0fada713b0d5994c3 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Fri, 5 Jul 2024 21:11:54 +0200 Subject: [PATCH] suppress DeprecationWarning because of asyncore import --- CREDITS | 5 ++++- HISTORY.rst | 2 ++ pyftpdlib/ioloop.py | 8 ++++++-- setup.py | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CREDITS b/CREDITS index e294fb56..9a96e68b 100644 --- a/CREDITS +++ b/CREDITS @@ -206,7 +206,10 @@ E: git@torypages.com C: Canada D: Command line argument enhancements - N: Tahir Ijaz W: https://github.com/tahirijaz24 D: issue 201, 435 + +N: Sandro +W: https://github.com/penguinpee +D: issue 637 diff --git a/HISTORY.rst b/HISTORY.rst index fdca9019..4bd580fe 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,8 @@ Version: 2.0.0 - (IN DEVELOPMENT) **Enhancements** * #629: removed Python 2.7 support. +* #637: remove copies of asyncore.py and asynchat.py. Use backports from PYPI + instead. (patch by @penguinpee) **Notes about backward compatibility** diff --git a/pyftpdlib/ioloop.py b/pyftpdlib/ioloop.py index 403e253f..735f27e9 100644 --- a/pyftpdlib/ioloop.py +++ b/pyftpdlib/ioloop.py @@ -56,8 +56,6 @@ def handle_accepted(self, sock, addr): IOLoop.instance().loop() """ -import asynchat -import asyncore import errno import heapq import os @@ -67,6 +65,7 @@ def handle_accepted(self, sock, addr): import threading import time import traceback +import warnings from .log import config_logging from .log import debug @@ -74,6 +73,11 @@ def handle_accepted(self, sock, addr): from .log import logger +with warnings.catch_warnings(): + warnings.simplefilter('ignore', DeprecationWarning) + import asynchat + import asyncore + timer = getattr(time, 'monotonic', time.time) _read = asyncore.read _write = asyncore.write diff --git a/setup.py b/setup.py index 93381f59..db9d6e2f 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,7 @@ def main(): install_requires=[ "pyasyncore;python_version>='3.12'", "pyasynchat;python_version>='3.12'", - ], + ], extras_require=extras_require, classifiers=[ 'Development Status :: 5 - Production/Stable',