Skip to content

Commit bc3df70

Browse files
authored
bpo-18174: Fix fd_count() on FreeBSD (GH-7420)
Python 2.7 doesn't have FileNotFoundError exception: use OSError and errno.ENOENT.
1 parent 64856ad commit bc3df70

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/support/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,8 +2069,9 @@ def fd_count():
20692069
try:
20702070
names = os.listdir("/proc/self/fd")
20712071
return len(names)
2072-
except FileNotFoundError:
2073-
pass
2072+
except OSError as exc:
2073+
if exc.errno != errno.ENOENT:
2074+
raise
20742075

20752076
old_modes = None
20762077
if sys.platform == 'win32':

0 commit comments

Comments
 (0)