pombreda / pyftpdlib

Automatically exported from code.google.com/p/pyftpdlib
Other
0 stars 0 forks source link

Extending compatiblity with older asyncore/python versions #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
By using Python versions prior to 2.4 pyftpdlib fails starting on systems
where poll() is not available.

<snippet>
Traceback (most recent call last):
   File "/ffs/lib/python2.3/site-packages/pyftpdlib/FTPServer.py", line
1206, in serve_forever
    asyncore.loop(timeout=1, use_poll=True)
  File "/tgtsvr/lib/python2.3/asyncore.py", line 193, in loop
  File "/tgtsvr/lib/python2.3/asyncore.py", line 128, in poll2
ImportError: No module named poll
</snippet>

This does not happen with newer asyncore versions (included with Python 2.4
and higher) which first check if poll() is available or not, in which case
select() is silently used.
Instead of telling asyncore to use poll by default we should first check if
poll is available or not by simply using the following statement:

>>> asyncore.loop(timeout=1, use_poll=hasattr(asyncore.select, 'poll'))

This should grant backward compatibility with older asyncore versions
included with Python 2.2, 2.3 and 2.4.

Thanks to Greg Copeland (GCopeland AT efjohnson DOT com) for having
submitted such report.

Original issue reported on code.google.com by billiej...@gmail.com on 10 Jul 2007 at 1:35

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 17 Jul 2007 at 3:35

GoogleCodeExporter commented 9 years ago
Fixed in SVN, revision #13

Original comment by billiej...@gmail.com on 20 Jul 2007 at 2:20

GoogleCodeExporter commented 9 years ago
Setting this value to True breaks OS X systems due to the differing 
implementation of
select.poll() versus asyncore.poll()

However, setting it to False does not appear to break any test systems on any 
OS or
version of Python. I would recommend in that light that rather than 
implementing this
fix, we actually just set use_poll to False to allow asyncore to use it's own
internal implementation of poll()

Original comment by jlo...@gmail.com on 24 Jul 2007 at 7:59

GoogleCodeExporter commented 9 years ago
Fixed in SVN, set use_poll to False for compatibility with older Python 
versions and
to avoid OS X bug (Issue #26)

Original comment by jlo...@gmail.com on 24 Jul 2007 at 3:02

GoogleCodeExporter commented 9 years ago
Fixed in Revision 47

Original comment by jlo...@gmail.com on 24 Jul 2007 at 3:04

GoogleCodeExporter commented 9 years ago

Original comment by jlo...@gmail.com on 24 Jul 2007 at 3:10

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 25 Oct 2007 at 1:50

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 2 May 2008 at 6:31

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 13 Oct 2008 at 7:13

GoogleCodeExporter commented 9 years ago

Original comment by g.rodola on 11 Aug 2010 at 10:17