From: Victor Stinner Date: Tue, 5 Jun 2018 11:30:48 +0000 (+0200) Subject: bpo-18174: Fix fd_count() on FreeBSD (GH-7420) X-Git-Tag: v2.7.16rc1~267 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc3df70b266304f78ebe5eabead71cabd4738d12;p=thirdparty%2FPython%2Fcpython.git bpo-18174: Fix fd_count() on FreeBSD (GH-7420) Python 2.7 doesn't have FileNotFoundError exception: use OSError and errno.ENOENT. --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 8ffe1f861e69..f67c0da5644a 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':