bpo-35134: Add Include/cpython/fileutils.h header file (GH-18493) · python/cpython@8c3aee6 (original) (raw)
`@@ -18,173 +18,12 @@ PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
`
18
18
`size_t *error_pos);
`
19
19
`#endif
`
20
20
``
21
``
-
22
``
`-
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000
`
23
``
`-
typedef enum {
`
24
``
`-
_Py_ERROR_UNKNOWN=0,
`
25
``
`-
_Py_ERROR_STRICT,
`
26
``
`-
_Py_ERROR_SURROGATEESCAPE,
`
27
``
`-
_Py_ERROR_REPLACE,
`
28
``
`-
_Py_ERROR_IGNORE,
`
29
``
`-
_Py_ERROR_BACKSLASHREPLACE,
`
30
``
`-
_Py_ERROR_SURROGATEPASS,
`
31
``
`-
_Py_ERROR_XMLCHARREFREPLACE,
`
32
``
`-
_Py_ERROR_OTHER
`
33
``
`-
} _Py_error_handler;
`
34
``
-
35
``
`-
PyAPI_FUNC(_Py_error_handler) _Py_GetErrorHandler(const char *errors);
`
36
``
-
37
``
`-
PyAPI_FUNC(int) _Py_DecodeLocaleEx(
`
38
``
`-
const char *arg,
`
39
``
`-
wchar_t **wstr,
`
40
``
`-
size_t *wlen,
`
41
``
`-
const char **reason,
`
42
``
`-
int current_locale,
`
43
``
`-
_Py_error_handler errors);
`
44
``
-
45
``
`-
PyAPI_FUNC(int) _Py_EncodeLocaleEx(
`
46
``
`-
const wchar_t *text,
`
47
``
`-
char **str,
`
48
``
`-
size_t *error_pos,
`
49
``
`-
const char **reason,
`
50
``
`-
int current_locale,
`
51
``
`-
_Py_error_handler errors);
`
52
``
`-
#endif
`
53
``
-
54
21
`#ifndef Py_LIMITED_API
`
55
``
`-
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
`
56
``
-
57
``
`-
#if defined(MS_WINDOWS) || defined(APPLE)
`
58
``
`-
/* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611).
`
59
``
`-
On macOS 10.13, read() and write() with more than INT_MAX bytes
`
60
``
`-
fail with EINVAL (bpo-24658). */
`
61
``
`-
define _PY_READ_MAX INT_MAX
`
62
``
`-
define _PY_WRITE_MAX INT_MAX
`
63
``
`-
#else
`
64
``
`-
/* write() should truncate the input to PY_SSIZE_T_MAX bytes,
`
65
``
`-
but it's safer to do it ourself to have a portable behaviour */
`
66
``
`-
define _PY_READ_MAX PY_SSIZE_T_MAX
`
67
``
`-
define _PY_WRITE_MAX PY_SSIZE_T_MAX
`
``
22
`+
define Py_CPYTHON_FILEUTILS_H
`
``
23
`+
include "cpython/fileutils.h"
`
``
24
`+
undef Py_CPYTHON_FILEUTILS_H
`
68
25
`#endif
`
69
26
``
70
``
`-
#ifdef MS_WINDOWS
`
71
``
`-
struct _Py_stat_struct {
`
72
``
`-
unsigned long st_dev;
`
73
``
`-
uint64_t st_ino;
`
74
``
`-
unsigned short st_mode;
`
75
``
`-
int st_nlink;
`
76
``
`-
int st_uid;
`
77
``
`-
int st_gid;
`
78
``
`-
unsigned long st_rdev;
`
79
``
`-
__int64 st_size;
`
80
``
`-
time_t st_atime;
`
81
``
`-
int st_atime_nsec;
`
82
``
`-
time_t st_mtime;
`
83
``
`-
int st_mtime_nsec;
`
84
``
`-
time_t st_ctime;
`
85
``
`-
int st_ctime_nsec;
`
86
``
`-
unsigned long st_file_attributes;
`
87
``
`-
unsigned long st_reparse_tag;
`
88
``
`-
};
`
89
``
`-
#else
`
90
``
`-
define _Py_stat_struct stat
`
91
``
`-
#endif
`
92
``
-
93
``
`-
PyAPI_FUNC(int) _Py_fstat(
`
94
``
`-
int fd,
`
95
``
`-
struct _Py_stat_struct *status);
`
96
``
-
97
``
`-
PyAPI_FUNC(int) _Py_fstat_noraise(
`
98
``
`-
int fd,
`
99
``
`-
struct _Py_stat_struct *status);
`
100
``
-
101
``
`-
PyAPI_FUNC(int) _Py_stat(
`
102
``
`-
PyObject *path,
`
103
``
`-
struct stat *status);
`
104
``
-
105
``
`-
PyAPI_FUNC(int) _Py_open(
`
106
``
`-
const char *pathname,
`
107
``
`-
int flags);
`
108
``
-
109
``
`-
PyAPI_FUNC(int) _Py_open_noraise(
`
110
``
`-
const char *pathname,
`
111
``
`-
int flags);
`
112
``
-
113
``
`-
PyAPI_FUNC(FILE *) _Py_wfopen(
`
114
``
`-
const wchar_t *path,
`
115
``
`-
const wchar_t *mode);
`
116
``
-
117
``
`-
PyAPI_FUNC(FILE*) _Py_fopen(
`
118
``
`-
const char *pathname,
`
119
``
`-
const char *mode);
`
120
``
-
121
``
`-
PyAPI_FUNC(FILE*) _Py_fopen_obj(
`
122
``
`-
PyObject *path,
`
123
``
`-
const char *mode);
`
124
``
-
125
``
`-
PyAPI_FUNC(Py_ssize_t) _Py_read(
`
126
``
`-
int fd,
`
127
``
`-
void *buf,
`
128
``
`-
size_t count);
`
129
``
-
130
``
`-
PyAPI_FUNC(Py_ssize_t) _Py_write(
`
131
``
`-
int fd,
`
132
``
`-
const void *buf,
`
133
``
`-
size_t count);
`
134
``
-
135
``
`-
PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
`
136
``
`-
int fd,
`
137
``
`-
const void *buf,
`
138
``
`-
size_t count);
`
139
``
-
140
``
`-
#ifdef HAVE_READLINK
`
141
``
`-
PyAPI_FUNC(int) _Py_wreadlink(
`
142
``
`-
const wchar_t *path,
`
143
``
`-
wchar_t *buf,
`
144
``
`-
/* Number of characters of 'buf' buffer
`
145
``
`-
including the trailing NUL character */
`
146
``
`-
size_t buflen);
`
147
``
`-
#endif
`
148
``
-
149
``
`-
#ifdef HAVE_REALPATH
`
150
``
`-
PyAPI_FUNC(wchar_t*) _Py_wrealpath(
`
151
``
`-
const wchar_t *path,
`
152
``
`-
wchar_t *resolved_path,
`
153
``
`-
/* Number of characters of 'resolved_path' buffer
`
154
``
`-
including the trailing NUL character */
`
155
``
`-
size_t resolved_path_len);
`
156
``
`-
#endif
`
157
``
-
158
``
`-
#ifndef MS_WINDOWS
`
159
``
`-
PyAPI_FUNC(int) _Py_isabs(const wchar_t *path);
`
160
``
`-
#endif
`
161
``
-
162
``
`-
PyAPI_FUNC(int) _Py_abspath(const wchar_t *path, wchar_t **abspath_p);
`
163
``
-
164
``
`-
PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
`
165
``
`-
wchar_t *buf,
`
166
``
`-
/* Number of characters of 'buf' buffer
`
167
``
`-
including the trailing NUL character */
`
168
``
`-
size_t buflen);
`
169
``
-
170
``
`-
PyAPI_FUNC(int) _Py_get_inheritable(int fd);
`
171
``
-
172
``
`-
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
`
173
``
`-
int *atomic_flag_works);
`
174
``
-
175
``
`-
PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable,
`
176
``
`-
int *atomic_flag_works);
`
177
``
-
178
``
`-
PyAPI_FUNC(int) _Py_dup(int fd);
`
179
``
-
180
``
`-
#ifndef MS_WINDOWS
`
181
``
`-
PyAPI_FUNC(int) _Py_get_blocking(int fd);
`
182
``
-
183
``
`-
PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
`
184
``
`-
#endif /* !MS_WINDOWS */
`
185
``
-
186
``
`-
#endif /* Py_LIMITED_API */
`
187
``
-
188
27
`#ifdef __cplusplus
`
189
28
`}
`
190
29
`#endif
`