summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-05 11:30:48 (GMT)
committerGitHub <noreply@github.com>2018-06-05 11:30:48 (GMT)
commitbc3df70b266304f78ebe5eabead71cabd4738d12 (patch)
treea6bd363cef3d0389abe309cc6d4f26de34705ad9
parent64856ad8b7279718ff10a9fb32003c2221af7228 (diff)
downloadcpython-bc3df70b266304f78ebe5eabead71cabd4738d12.zip
cpython-bc3df70b266304f78ebe5eabead71cabd4738d12.tar.gz
cpython-bc3df70b266304f78ebe5eabead71cabd4738d12.tar.bz2
bpo-18174: Fix fd_count() on FreeBSD (GH-7420)
Python 2.7 doesn't have FileNotFoundError exception: use OSError and errno.ENOENT.
-rw-r--r--Lib/test/support/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 8ffe1f8..f67c0da 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':