classification
Title: Replace asyncore
Type: Stage: needs patch
Components: asyncio Versions: Python 3.7
process
Status: open Resolution:
Dependencies: 30514 Superseder:
Assigned To: Nosy List: Mariatta, grzgrzgrz3, vstinner, yselivanov
Priority: normal Keywords:

Created on 2016-10-25 18:32 by Mariatta, last changed 2017-05-30 17:35 by gvanrossum.

Messages (7)
msg279439 - (view) Author: Mariatta Wijaya (Mariatta) * (Python committer) Date: 2016-10-25 18:32
Deprecation warning was added to asyncore in https://bugs.python.org/issue25002

asyncore is still used in several tests and should be replaced.
msg291907 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-04-19 21:40
> asyncore is still used in several tests and should be replaced.

Here is the list of Python files using asyncore:

haypo@selma$ grep -l asyncore $(find -name "*.py")
./Lib/asyncore.py
./Lib/asynchat.py
./Lib/test/test_smtpd.py
./Lib/test/test_asyncore.py
./Lib/test/test_smtplib.py
./Lib/test/test_os.py
./Lib/test/test_ssl.py
./Lib/test/test_logging.py
./Lib/test/libregrtest/save_env.py
./Lib/test/test_asynchat.py
./Lib/test/test_pyclbr.py
./Lib/test/test_support.py
./Lib/test/test_poplib.py
./Lib/test/test_ftplib.py
./Lib/smtpd.py

smtpd has been rewritten with asyncio:
http://aiosmtpd.readthedocs.io/

The documentation of the smtpd module already points to aiosmtpd.

libregrtest/save_env.py only checks that asyncore.socket_map is not modified, we can keep it until asyncore is really removed.

test_support.py only tests that it's possible to have a "clean" import of asyncore, it can be easily be replaced later.

The list can reduced to:

./Lib/test/test_smtplib.py
./Lib/test/test_os.py
./Lib/test/test_ssl.py
./Lib/test/test_logging.py
./Lib/test/test_pyclbr.py
./Lib/test/test_poplib.py
./Lib/test/test_ftplib.py
msg291908 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-04-19 21:41
asyncore was modified to emit a DeprecationWarning:
http://bugs.python.org/issue25002#msg279417

But then a lot of code starts with to fail -Werror.

Copy of Martin Panter's msg279469:

I normally run the tests with -Werror, and the failures I get are:

* test_ssl, test_smtplib, test_poplib, test_logging, test_ftplib, test_support: tests use asyncore
* test_os: test uses asynchat (When you import asynchat, the first error complains about importing asyncore, there are actually two warnings)
* test_all: This seems to ignore DeprecationWarning; perhaps an exception for PendingDeprecationWarning should also be added?
* test_asyncore and test_asynchat: Obviously these have to still test the modules, so they should anticipate the warnings, perhaps using Serhiy’s code
* test_smtpd: smtpd module itself uses asyncore; see Issue 25008
msg294710 - (view) Author: Grzegorz Grzywacz (grzgrzgrz3) * Date: 2017-05-29 19:46
I would like to work on this issue.

I think it's a good idea to split this task into few parts/PR.

Let me start from ./Lib/test/test_poplib.py.

What about rewriting pop3 server stub using asyncio, i think requests could be handled synchronously, there will be no benefits from asynchronous.

Please let me know what you think.
msg294712 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-29 20:34
> I think it's a good idea to split this task into few parts/PR. Let me start from ./Lib/test/test_poplib.py.

Once you have a patch, open a new issue and mention it here.
msg294771 - (view) Author: Grzegorz Grzywacz (grzgrzgrz3) * Date: 2017-05-30 17:25
./Lib/test/test_poplib.py
sub-issue issue28533
msg294773 - (view) Author: Grzegorz Grzywacz (grzgrzgrz3) * Date: 2017-05-30 17:29
./Lib/test/test_poplib.py
sub-issue issue30514

Fixed issue number from previous comment
History
Date User Action Args
2017-05-30 17:35:04gvanrossumsetnosy: - gvanrossum
2017-05-30 17:32:46Mariattasetdependencies: + test_poplib replace asyncore
2017-05-30 17:29:20grzgrzgrz3setmessages: + msg294773
2017-05-30 17:25:17grzgrzgrz3setmessages: + msg294771
2017-05-29 20:45:09Mariattasetstage: needs patch
versions: + Python 3.7
2017-05-29 20:34:16vstinnersetmessages: + msg294712
2017-05-29 19:46:56grzgrzgrz3setnosy: + grzgrzgrz3
messages: + msg294710
2017-04-19 21:41:40vstinnersetmessages: + msg291908
2017-04-19 21:40:01vstinnersetnosy: + vstinner
messages: + msg291907
2016-10-25 18:33:12Mariattasetnosy: + gvanrossum, yselivanov
components: + asyncio
2016-10-25 18:32:04Mariattacreate