Changeset 1674:b2e19844d663


Ignore:
Timestamp:
Oct 28, 2017, 6:25:26 PM (14 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Catch `EOFError` in `_available_child`

If `host._session.pwd` raises an `EOFError`, catch it and don't
consider the affected child host for a new file-like object.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ftputil/host.py

    r1672 r1674  
    181181                # an FTP session timeout.
    182182                except OSError:
     183                    continue
     184                # The server may close the connection which may cause
     185                # `host._session.getline` raise an `EOFError` (see
     186                # ticket #114).
     187                except EOFError:
    183188                    continue
    184189                else:
  • test/test_file.py

    r1673 r1674  
    282282        """
    283283        self._test_with_pwd_error(OSError)
     284
     285    def test_pwd_with_EOFError(self):
     286        """
     287        Test if an `EOFError` in `_session.pwd` skips the child
     288        session.
     289        """
     290        self._test_with_pwd_error(EOFError)
Note: See TracChangeset for help on using the changeset viewer.