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:
parent
64856ad8b7
commit
bc3df70b26
|
@ -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':
|
||||
|
|
Loading…
Reference in New Issue