bpo-40422: Move _Py_*_SUPPRESS_IPH bits into _Py_closerange (GH-22672)

This suppression is no longer needed in os_closerange_impl, as it just
invokes the internal _Py_closerange implementation. On the other hand,
consumers of _Py_closerange may not have any other reason to suppress
invalid parameter issues, so narrow the scope to here.
This commit is contained in:
Kyle Evans 2020-10-12 18:53:16 -05:00 committed by GitHub
parent ba06a70c82
commit 64eb259cc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -8782,6 +8782,7 @@ void
_Py_closerange(int first, int last) _Py_closerange(int first, int last)
{ {
first = Py_MAX(first, 0); first = Py_MAX(first, 0);
_Py_BEGIN_SUPPRESS_IPH
#ifdef HAVE_CLOSE_RANGE #ifdef HAVE_CLOSE_RANGE
if (close_range(first, last, 0) == 0 || errno != ENOSYS) { if (close_range(first, last, 0) == 0 || errno != ENOSYS) {
/* Any errors encountered while closing file descriptors are ignored; /* Any errors encountered while closing file descriptors are ignored;
@ -8812,6 +8813,7 @@ _Py_closerange(int first, int last)
} }
} }
#endif /* USE_FDWALK */ #endif /* USE_FDWALK */
_Py_END_SUPPRESS_IPH
} }
/*[clinic input] /*[clinic input]
@ -8829,9 +8831,7 @@ os_closerange_impl(PyObject *module, int fd_low, int fd_high)
/*[clinic end generated code: output=0ce5c20fcda681c2 input=5855a3d053ebd4ec]*/ /*[clinic end generated code: output=0ce5c20fcda681c2 input=5855a3d053ebd4ec]*/
{ {
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
_Py_closerange(fd_low, fd_high - 1); _Py_closerange(fd_low, fd_high - 1);
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
Py_RETURN_NONE; Py_RETURN_NONE;
} }