Skip to content

Commit adb27ea

Browse files
authored
gh-106320: Remove _PyIsSelectable_fd() C API (#107142)
Move _PyIsSelectable_fd() macro to the internal C API (pycore_fileutils.h).
1 parent 956b3de commit adb27ea

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Include/fileobject.h

-8
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
2929
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_UTF8Mode;
3030
#endif
3131

32-
/* A routine to check if a file descriptor can be select()-ed. */
33-
#ifdef _MSC_VER
34-
/* On Windows, any socket fd can be select()-ed, no matter how high */
35-
#define _PyIsSelectable_fd(FD) (1)
36-
#else
37-
#define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
38-
#endif
39-
4032
#ifndef Py_LIMITED_API
4133
# define Py_CPYTHON_FILEOBJECT_H
4234
# include "cpython/fileobject.h"

Include/internal/pycore_fileutils.h

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ extern "C" {
1010

1111
#include <locale.h> /* struct lconv */
1212

13+
/* A routine to check if a file descriptor can be select()-ed. */
14+
#ifdef _MSC_VER
15+
/* On Windows, any socket fd can be select()-ed, no matter how high */
16+
#define _PyIsSelectable_fd(FD) (1)
17+
#else
18+
#define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
19+
#endif
1320

1421
struct _fileutils_state {
1522
int force_ascii;

Modules/_ssl.c

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define OPENSSL_NO_DEPRECATED 1
2727

2828
#include "Python.h"
29+
#include "pycore_fileutils.h" // _PyIsSelectable_fd()
2930
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
3031

3132
/* Include symbols from _socket module */

0 commit comments

Comments
 (0)