From bc3df70b266304f78ebe5eabead71cabd4738d12 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 5 Jun 2018 13:30:48 +0200 Subject: [PATCH] bpo-18174: Fix fd_count() on FreeBSD (GH-7420) Python 2.7 doesn't have FileNotFoundError exception: use OSError and errno.ENOENT. --- Lib/test/support/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 8ffe1f861e6..f67c0da5644 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -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':