summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-23 19:07:12 (GMT)
committerGitHub <noreply@github.com>2023-07-23 19:07:12 (GMT)
commitadb27ea2d5e2f74f4be8f15b199889161c33e801 (patch)
tree5fc0996181ba84e5c73a5372ffd741e101b676f2
parent956b3de816f4b18f6b947a11c8eec6c39f60ea88 (diff)
downloadcpython-adb27ea2d5e2f74f4be8f15b199889161c33e801.zip
cpython-adb27ea2d5e2f74f4be8f15b199889161c33e801.tar.gz
cpython-adb27ea2d5e2f74f4be8f15b199889161c33e801.tar.bz2
gh-106320: Remove _PyIsSelectable_fd() C API (#107142)
Move _PyIsSelectable_fd() macro to the internal C API (pycore_fileutils.h).
-rw-r--r--Include/fileobject.h8
-rw-r--r--Include/internal/pycore_fileutils.h7
-rw-r--r--Modules/_ssl.c1
3 files changed, 8 insertions, 8 deletions
diff --git a/Include/fileobject.h b/Include/fileobject.h
index 2deef54..6a6d114 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -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"
diff --git a/Include/internal/pycore_fileutils.h b/Include/internal/pycore_fileutils.h
index ef6642d..7ba9b3e 100644
--- a/Include/internal/pycore_fileutils.h
+++ b/Include/internal/pycore_fileutils.h
@@ -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;
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index ed720b4..699431c 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -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 */