[New-bugs-announce] [issue30994] Asyncore does not need to copy map.items() before polling

Nir Soffer report at bugs.python.org
Sat Jul 22 20:15:19 EDT 2017


New submission from Nir Soffer:

Asyncore is not thread safe, and cannot be called from multiple threads. Hence it does not need to copy the socket_map when preparing for poll or
select.

The copy was introduced in:

commit d74900ebb5a22b387b49684990da1925e1d6bdc9
Author: Josiah Carlson <josiah.carlson at gmail.com>
Date:   Mon Jul 7 04:15:08 2008 +0000

    Committing Py3k version of changelist 64080 and 64257, along with updated tests
    for smtpd, which required updating with the new semantics.

This is a huge patch, looks like port of asyncore to python 3, trying to 
keep the behavior of the python 2 code.

Converting map.items() to list(map.items()) is correct, but on python 3 we
can take advantage of the fact that items() does not copy anything.

----------
components: Library (Lib)
messages: 298880
nosy: Nir Soffer, giampaolo.rodola, haypo
priority: normal
severity: normal
status: open
title: Asyncore does not need to copy map.items() before polling
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30994>
_______________________________________


More information about the New-bugs-announce mailing list