This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: asyncore loop_once and remove poll2
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, kjetilja, loewis
Priority: normal Keywords: patch

Created on 2002-12-04 10:55 by kjetilja, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
asyncore.patch kjetilja, 2002-12-04 10:55 remove poll2 and add loop_once
Messages (6)
msg41868 - (view) Author: Kjetil Jacobsen (kjetilja) Date: 2002-12-04 10:55
this patch does two things to asyncore.py, none of them should break any existing code which uses the module:

1) remove the (broken) poll2 function, and rather make a reference from poll2 to poll3 in the module namespace (i.e. if someone actually uses the poll2 function, poll3 will be called instead).

2) add a function loop_once which performs the asyncore loop once instead of until the socket map is empty.  asyncore.loop_once has the same function signature as asyncore.loop.



msg41869 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-12-05 16:49
Logged In: YES 
user_id=21627

Can you please explain in what way poll2 is broken?

Also, what happens if use_poll is set, but there is no poll 
available on the system?
msg41870 - (view) Author: Kjetil Jacobsen (kjetilja) Date: 2002-12-05 18:46
Logged In: YES 
user_id=5685

asyncore.poll2 is broken because it does not mask the EINTR exception when invoking the poll.poll function.  this causes asyncore.poll2 to not have the same semantics as asyncore.poll and asyncore.poll3.

i don't see the point in preserving support for the poll2 function, as the poll function is now automatically a part of the select module if the system has poll support.   or am i missing something obvious here? :)

if use_poll is set and there is no poll on the system, asyncore.loop and asyncore.loop_once will fail the same way they did before.  
msg41871 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-10-22 14:28
Logged In: YES 
user_id=11375

poll2() is written for a "poll" extension module that came with the Medusa 
distribution, so it'll never be used with a Python installation and poll2() can be 
safely removed.  

I'm less enthusiastic about loop_once().  Existing code that needs to loop once 
has been simply calling asyncore.poll(), which works fine (though perhaps 
suboptimally -- but 99% of asyncore applications won't care).  
msg41872 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-10-22 14:40
Logged In: YES 
user_id=11375

Partially checked in; the existing poll2() implementation has been removed in 
rev.1.43 in CVS.
msg41873 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2004-07-10 17:18
Logged In: YES 
user_id=11375

loop() now takes an optional 'count' parameter, so this patch can now be 
closed.  Thanks for submitting it!
History
Date User Action Args
2022-04-10 16:05:57adminsetgithub: 37567
2002-12-04 10:55:36kjetiljacreate