bpo-18174: Fix fd_count() on FreeBSD (GH-7420)

Python 2.7 doesn't have FileNotFoundError exception: use OSError and
errno.ENOENT.
This commit is contained in:
Victor Stinner 2018-06-05 13:30:48 +02:00 committed by GitHub
parent 64856ad8b7
commit bc3df70b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -2069,8 +2069,9 @@ def fd_count():
try:
names = os.listdir("/proc/self/fd")
return len(names)
except FileNotFoundError:
pass
except OSError as exc:
if exc.errno != errno.ENOENT:
raise
old_modes = None
if sys.platform == 'win32':