alexdelorenzo/aiopath

Import Fails on Python 3.7.0

curtis-lamp opened this issue · 0 comments

In 3.7.0 the _ignore_error function doesn't exist in pathlib, so aiopath fails to import.

Adding a try/except block around this import that on except executes the following from cpython would solve this issue.

_WINERROR_NOT_READY = 21  # drive exists but is not accessible
_WINERROR_INVALID_NAME = 123  # fix for bpo-35306
_WINERROR_CANT_RESOLVE_FILENAME = 1921  # broken symlink pointing to itself

_IGNORED_ERRNOS = (ENOENT, ENOTDIR, EBADF, ELOOP)

_IGNORED_WINERRORS = (
    _WINERROR_NOT_READY,
    _WINERROR_INVALID_NAME,
    _WINERROR_CANT_RESOLVE_FILENAME)

def _ignore_error(exception):
    return (getattr(exception, 'errno', None) in _IGNORED_ERRNOS or
            getattr(exception, 'winerror', None) in _IGNORED_WINERRORS)

This would have to be in a 0.5.13 release to support older pythons. I'll happily submit a PR for this.