]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106320: Remove _PyIsSelectable_fd() C API (#107142)
authorVictor Stinner <vstinner@python.org>
Sun, 23 Jul 2023 19:07:12 +0000 (21:07 +0200)
committerGitHub <noreply@github.com>
Sun, 23 Jul 2023 19:07:12 +0000 (19:07 +0000)
Move _PyIsSelectable_fd() macro to the internal C API
(pycore_fileutils.h).

Include/fileobject.h
Include/internal/pycore_fileutils.h
Modules/_ssl.c

index 2deef544d667a568f567786decd4d474f062f10b..6a6d11409497fab0fac0b20851af8786fd09545a 100644 (file)
@@ -29,14 +29,6 @@ Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
 Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_UTF8Mode;
 #endif
 
-/* A routine to check if a file descriptor can be select()-ed. */
-#ifdef _MSC_VER
-    /* On Windows, any socket fd can be select()-ed, no matter how high */
-    #define _PyIsSelectable_fd(FD) (1)
-#else
-    #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
-#endif
-
 #ifndef Py_LIMITED_API
 #  define Py_CPYTHON_FILEOBJECT_H
 #  include "cpython/fileobject.h"
index ef6642d00f1b54f3c8c1273c7c3c68b7614d2c05..7ba9b3ee58be4167fa21470e5508f5ac87ece85a 100644 (file)
@@ -10,6 +10,13 @@ extern "C" {
 
 #include <locale.h>   /* struct lconv */
 
+/* A routine to check if a file descriptor can be select()-ed. */
+#ifdef _MSC_VER
+    /* On Windows, any socket fd can be select()-ed, no matter how high */
+    #define _PyIsSelectable_fd(FD) (1)
+#else
+    #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
+#endif
 
 struct _fileutils_state {
     int force_ascii;
index ed720b4295f8ec107f495f57b6169b8a4f0b6f50..699431c248a07164cbf2bb33cafb7fb2dd71559f 100644 (file)
@@ -26,6 +26,7 @@
 #define OPENSSL_NO_DEPRECATED 1
 
 #include "Python.h"
+#include "pycore_fileutils.h"     // _PyIsSelectable_fd()
 #include "pycore_weakref.h"       // _PyWeakref_GET_REF()
 
 /* Include symbols from _socket module */