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

Lines changed: 0 additions & 8 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy