]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-18174: Fix fd_count() on FreeBSD (GH-7420)
authorVictor Stinner <vstinner@redhat.com>
Tue, 5 Jun 2018 11:30:48 +0000 (13:30 +0200)
committerGitHub <noreply@github.com>
Tue, 5 Jun 2018 11:30:48 +0000 (13:30 +0200)
Python 2.7 doesn't have FileNotFoundError exception: use OSError and
errno.ENOENT.

Lib/test/support/__init__.py

index 8ffe1f861e6936be3e2ca75cef9f94882e37851d..f67c0da5644a9f6497632d3f27bc8c4780050c5b 100644 (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':