On 08/04/2010, Victor Stinner <victor.stin...@haypocalc.com> wrote: > Le jeudi 08 avril 2010 08:11:09, Yaniv Aknin a écrit : >> Issue #7978 (http://bugs.python.org/issue7978) describes a bug in >> SocketServer where a received signal in SocketServer's select() call >> will raise an uncaught exception due to EINTR. The proposed solution >> was to wrap SocketServer's select() with something like twisted's >> untilConcludes function, which catches EINTR exceptions and re-calls >> the call (see issue for code). >> >> However, before committing this to SocketServer, neologix raised the >> (valid) concern that this is generally-useful code, already duplicated >> at least in subprocess (_eintr_retry_call, subprocess.py), which can >> probably be moved to another module and be shared from there. (...) > > +1 to share EINTR-related code, but I don't know the best place for such > functions. Maybe the os module?
Bazaar did a similar thing in copying the Twisted function to a generic module for use throughout the codebase. From the experience there, I think replicating that would be a bad idea. There are a very large number of functions in the Python standard library that can throw EINTR, but hardly any of them can be "fixed" by wrapping them in a function that catches the error and mindlessly recalls the function with the same arguments. In Bazaar, until_no_eintr proved to be an attractive nuisance that lead to incorrect code. Providing such an easily misused interface in the standard library is likely to do more harm than good. There are some errors and other confusions in the initial post and later, but reading this thread from the Bazaar list should give an impression: <https://lists.ubuntu.com/archives/bazaar/2010q1/066869.html> Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com