Branch data Line data Source code
1 : :
2 : : /* Errno module */
3 : :
4 : : #include "Python.h"
5 : :
6 : : /* Windows socket errors (WSA*) */
7 : : #ifdef MS_WINDOWS
8 : : #ifndef WIN32_LEAN_AND_MEAN
9 : : #define WIN32_LEAN_AND_MEAN
10 : : #endif
11 : : #include <windows.h>
12 : : /* The following constants were added to errno.h in VS2010 but have
13 : : preferred WSA equivalents. */
14 : : #undef EADDRINUSE
15 : : #undef EADDRNOTAVAIL
16 : : #undef EAFNOSUPPORT
17 : : #undef EALREADY
18 : : #undef ECONNABORTED
19 : : #undef ECONNREFUSED
20 : : #undef ECONNRESET
21 : : #undef EDESTADDRREQ
22 : : #undef EHOSTUNREACH
23 : : #undef EINPROGRESS
24 : : #undef EISCONN
25 : : #undef ELOOP
26 : : #undef EMSGSIZE
27 : : #undef ENETDOWN
28 : : #undef ENETRESET
29 : : #undef ENETUNREACH
30 : : #undef ENOBUFS
31 : : #undef ENOPROTOOPT
32 : : #undef ENOTCONN
33 : : #undef ENOTSOCK
34 : : #undef EOPNOTSUPP
35 : : #undef EPROTONOSUPPORT
36 : : #undef EPROTOTYPE
37 : : #undef ETIMEDOUT
38 : : #undef EWOULDBLOCK
39 : : #endif
40 : :
41 : : /*
42 : : * Pull in the system error definitions
43 : : */
44 : :
45 : : static PyMethodDef errno_methods[] = {
46 : : {NULL, NULL}
47 : : };
48 : :
49 : : /* Helper function doing the dictionary inserting */
50 : :
51 : : static int
52 : 544 : _add_errcode(PyObject *module_dict, PyObject *error_dict, const char *name_str, int code_int)
53 : : {
54 : 544 : PyObject *name = PyUnicode_FromString(name_str);
55 [ - + ]: 544 : if (!name) {
56 : 0 : return -1;
57 : : }
58 : :
59 : 544 : PyObject *code = PyLong_FromLong(code_int);
60 [ - + ]: 544 : if (!code) {
61 : 0 : Py_DECREF(name);
62 : 0 : return -1;
63 : : }
64 : :
65 : 544 : int ret = -1;
66 : : /* insert in modules dict */
67 [ - + ]: 544 : if (PyDict_SetItem(module_dict, name, code) < 0) {
68 : 0 : goto end;
69 : : }
70 : : /* insert in errorcode dict */
71 [ - + ]: 544 : if (PyDict_SetItem(error_dict, code, name) < 0) {
72 : 0 : goto end;
73 : : }
74 : 544 : ret = 0;
75 : 544 : end:
76 : 544 : Py_DECREF(name);
77 : 544 : Py_DECREF(code);
78 : 544 : return ret;
79 : : }
80 : :
81 : : static int
82 : 4 : errno_exec(PyObject *module)
83 : : {
84 : 4 : PyObject *module_dict = PyModule_GetDict(module);
85 : 4 : PyObject *error_dict = PyDict_New();
86 [ + - - + ]: 4 : if (!module_dict || !error_dict) {
87 : 0 : return -1;
88 : : }
89 [ - + ]: 4 : if (PyDict_SetItemString(module_dict, "errorcode", error_dict) < 0) {
90 : 0 : Py_DECREF(error_dict);
91 : 0 : return -1;
92 : : }
93 : :
94 : : /* Macro so I don't have to edit each and every line below... */
95 : : #define add_errcode(name, code, comment) \
96 : : do { \
97 : : if (_add_errcode(module_dict, error_dict, name, code) < 0) { \
98 : : Py_DECREF(error_dict); \
99 : : return -1; \
100 : : } \
101 : : } while (0);
102 : :
103 : : /*
104 : : * The names and comments are borrowed from linux/include/errno.h,
105 : : * which should be pretty all-inclusive. However, the Solaris specific
106 : : * names and comments are borrowed from sys/errno.h in Solaris.
107 : : * MacOSX specific names and comments are borrowed from sys/errno.h in
108 : : * MacOSX.
109 : : */
110 : :
111 : : #ifdef ENODEV
112 [ - + ]: 4 : add_errcode("ENODEV", ENODEV, "No such device");
113 : : #endif
114 : : #ifdef ENOCSI
115 [ - + ]: 4 : add_errcode("ENOCSI", ENOCSI, "No CSI structure available");
116 : : #endif
117 : : #ifdef EHOSTUNREACH
118 [ - + ]: 4 : add_errcode("EHOSTUNREACH", EHOSTUNREACH, "No route to host");
119 : : #else
120 : : #ifdef WSAEHOSTUNREACH
121 : : add_errcode("EHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
122 : : #endif
123 : : #endif
124 : : #ifdef ENOMSG
125 [ - + ]: 4 : add_errcode("ENOMSG", ENOMSG, "No message of desired type");
126 : : #endif
127 : : #ifdef EUCLEAN
128 [ - + ]: 4 : add_errcode("EUCLEAN", EUCLEAN, "Structure needs cleaning");
129 : : #endif
130 : : #ifdef EL2NSYNC
131 [ - + ]: 4 : add_errcode("EL2NSYNC", EL2NSYNC, "Level 2 not synchronized");
132 : : #endif
133 : : #ifdef EL2HLT
134 [ - + ]: 4 : add_errcode("EL2HLT", EL2HLT, "Level 2 halted");
135 : : #endif
136 : : #ifdef ENODATA
137 [ - + ]: 4 : add_errcode("ENODATA", ENODATA, "No data available");
138 : : #endif
139 : : #ifdef ENOTBLK
140 [ - + ]: 4 : add_errcode("ENOTBLK", ENOTBLK, "Block device required");
141 : : #endif
142 : : #ifdef ENOSYS
143 [ - + ]: 4 : add_errcode("ENOSYS", ENOSYS, "Function not implemented");
144 : : #endif
145 : : #ifdef EPIPE
146 [ - + ]: 4 : add_errcode("EPIPE", EPIPE, "Broken pipe");
147 : : #endif
148 : : #ifdef EINVAL
149 [ - + ]: 4 : add_errcode("EINVAL", EINVAL, "Invalid argument");
150 : : #else
151 : : #ifdef WSAEINVAL
152 : : add_errcode("EINVAL", WSAEINVAL, "Invalid argument");
153 : : #endif
154 : : #endif
155 : : #ifdef EOVERFLOW
156 [ - + ]: 4 : add_errcode("EOVERFLOW", EOVERFLOW, "Value too large for defined data type");
157 : : #endif
158 : : #ifdef EADV
159 [ - + ]: 4 : add_errcode("EADV", EADV, "Advertise error");
160 : : #endif
161 : : #ifdef EINTR
162 [ - + ]: 4 : add_errcode("EINTR", EINTR, "Interrupted system call");
163 : : #else
164 : : #ifdef WSAEINTR
165 : : add_errcode("EINTR", WSAEINTR, "Interrupted system call");
166 : : #endif
167 : : #endif
168 : : #ifdef EUSERS
169 [ - + ]: 4 : add_errcode("EUSERS", EUSERS, "Too many users");
170 : : #else
171 : : #ifdef WSAEUSERS
172 : : add_errcode("EUSERS", WSAEUSERS, "Too many users");
173 : : #endif
174 : : #endif
175 : : #ifdef ENOTEMPTY
176 [ - + ]: 4 : add_errcode("ENOTEMPTY", ENOTEMPTY, "Directory not empty");
177 : : #else
178 : : #ifdef WSAENOTEMPTY
179 : : add_errcode("ENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
180 : : #endif
181 : : #endif
182 : : #ifdef ENOBUFS
183 [ - + ]: 4 : add_errcode("ENOBUFS", ENOBUFS, "No buffer space available");
184 : : #else
185 : : #ifdef WSAENOBUFS
186 : : add_errcode("ENOBUFS", WSAENOBUFS, "No buffer space available");
187 : : #endif
188 : : #endif
189 : : #ifdef EPROTO
190 [ - + ]: 4 : add_errcode("EPROTO", EPROTO, "Protocol error");
191 : : #endif
192 : : #ifdef EREMOTE
193 [ - + ]: 4 : add_errcode("EREMOTE", EREMOTE, "Object is remote");
194 : : #else
195 : : #ifdef WSAEREMOTE
196 : : add_errcode("EREMOTE", WSAEREMOTE, "Object is remote");
197 : : #endif
198 : : #endif
199 : : #ifdef ENAVAIL
200 [ - + ]: 4 : add_errcode("ENAVAIL", ENAVAIL, "No XENIX semaphores available");
201 : : #endif
202 : : #ifdef ECHILD
203 [ - + ]: 4 : add_errcode("ECHILD", ECHILD, "No child processes");
204 : : #endif
205 : : #ifdef ELOOP
206 [ - + ]: 4 : add_errcode("ELOOP", ELOOP, "Too many symbolic links encountered");
207 : : #else
208 : : #ifdef WSAELOOP
209 : : add_errcode("ELOOP", WSAELOOP, "Too many symbolic links encountered");
210 : : #endif
211 : : #endif
212 : : #ifdef EXDEV
213 [ - + ]: 4 : add_errcode("EXDEV", EXDEV, "Cross-device link");
214 : : #endif
215 : : #ifdef E2BIG
216 [ - + ]: 4 : add_errcode("E2BIG", E2BIG, "Arg list too long");
217 : : #endif
218 : : #ifdef ESRCH
219 [ - + ]: 4 : add_errcode("ESRCH", ESRCH, "No such process");
220 : : #endif
221 : : #ifdef EMSGSIZE
222 [ - + ]: 4 : add_errcode("EMSGSIZE", EMSGSIZE, "Message too long");
223 : : #else
224 : : #ifdef WSAEMSGSIZE
225 : : add_errcode("EMSGSIZE", WSAEMSGSIZE, "Message too long");
226 : : #endif
227 : : #endif
228 : : #ifdef EAFNOSUPPORT
229 [ - + ]: 4 : add_errcode("EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol");
230 : : #else
231 : : #ifdef WSAEAFNOSUPPORT
232 : : add_errcode("EAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
233 : : #endif
234 : : #endif
235 : : #ifdef EBADR
236 [ - + ]: 4 : add_errcode("EBADR", EBADR, "Invalid request descriptor");
237 : : #endif
238 : : #ifdef EHOSTDOWN
239 [ - + ]: 4 : add_errcode("EHOSTDOWN", EHOSTDOWN, "Host is down");
240 : : #else
241 : : #ifdef WSAEHOSTDOWN
242 : : add_errcode("EHOSTDOWN", WSAEHOSTDOWN, "Host is down");
243 : : #endif
244 : : #endif
245 : : #ifdef EPFNOSUPPORT
246 [ - + ]: 4 : add_errcode("EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported");
247 : : #else
248 : : #ifdef WSAEPFNOSUPPORT
249 : : add_errcode("EPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
250 : : #endif
251 : : #endif
252 : : #ifdef ENOPROTOOPT
253 [ - + ]: 4 : add_errcode("ENOPROTOOPT", ENOPROTOOPT, "Protocol not available");
254 : : #else
255 : : #ifdef WSAENOPROTOOPT
256 : : add_errcode("ENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
257 : : #endif
258 : : #endif
259 : : #ifdef EBUSY
260 [ - + ]: 4 : add_errcode("EBUSY", EBUSY, "Device or resource busy");
261 : : #endif
262 : : #ifdef EWOULDBLOCK
263 [ - + ]: 4 : add_errcode("EWOULDBLOCK", EWOULDBLOCK, "Operation would block");
264 : : #else
265 : : #ifdef WSAEWOULDBLOCK
266 : : add_errcode("EWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
267 : : #endif
268 : : #endif
269 : : #ifdef EBADFD
270 [ - + ]: 4 : add_errcode("EBADFD", EBADFD, "File descriptor in bad state");
271 : : #endif
272 : : #ifdef EDOTDOT
273 [ - + ]: 4 : add_errcode("EDOTDOT", EDOTDOT, "RFS specific error");
274 : : #endif
275 : : #ifdef EISCONN
276 [ - + ]: 4 : add_errcode("EISCONN", EISCONN, "Transport endpoint is already connected");
277 : : #else
278 : : #ifdef WSAEISCONN
279 : : add_errcode("EISCONN", WSAEISCONN, "Transport endpoint is already connected");
280 : : #endif
281 : : #endif
282 : : #ifdef ENOANO
283 [ - + ]: 4 : add_errcode("ENOANO", ENOANO, "No anode");
284 : : #endif
285 : : #if defined(__wasi__) && !defined(ESHUTDOWN)
286 : : // WASI SDK 16 does not have ESHUTDOWN, shutdown results in EPIPE.
287 : : #define ESHUTDOWN EPIPE
288 : : #endif
289 : : #ifdef ESHUTDOWN
290 [ - + ]: 4 : add_errcode("ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown");
291 : : #else
292 : : #ifdef WSAESHUTDOWN
293 : : add_errcode("ESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
294 : : #endif
295 : : #endif
296 : : #ifdef ECHRNG
297 [ - + ]: 4 : add_errcode("ECHRNG", ECHRNG, "Channel number out of range");
298 : : #endif
299 : : #ifdef ELIBBAD
300 [ - + ]: 4 : add_errcode("ELIBBAD", ELIBBAD, "Accessing a corrupted shared library");
301 : : #endif
302 : : #ifdef ENONET
303 [ - + ]: 4 : add_errcode("ENONET", ENONET, "Machine is not on the network");
304 : : #endif
305 : : #ifdef EBADE
306 [ - + ]: 4 : add_errcode("EBADE", EBADE, "Invalid exchange");
307 : : #endif
308 : : #ifdef EBADF
309 [ - + ]: 4 : add_errcode("EBADF", EBADF, "Bad file number");
310 : : #else
311 : : #ifdef WSAEBADF
312 : : add_errcode("EBADF", WSAEBADF, "Bad file number");
313 : : #endif
314 : : #endif
315 : : #ifdef EMULTIHOP
316 [ - + ]: 4 : add_errcode("EMULTIHOP", EMULTIHOP, "Multihop attempted");
317 : : #endif
318 : : #ifdef EIO
319 [ - + ]: 4 : add_errcode("EIO", EIO, "I/O error");
320 : : #endif
321 : : #ifdef EUNATCH
322 [ - + ]: 4 : add_errcode("EUNATCH", EUNATCH, "Protocol driver not attached");
323 : : #endif
324 : : #ifdef EPROTOTYPE
325 [ - + ]: 4 : add_errcode("EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket");
326 : : #else
327 : : #ifdef WSAEPROTOTYPE
328 : : add_errcode("EPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
329 : : #endif
330 : : #endif
331 : : #ifdef ENOSPC
332 [ - + ]: 4 : add_errcode("ENOSPC", ENOSPC, "No space left on device");
333 : : #endif
334 : : #ifdef ENOEXEC
335 [ - + ]: 4 : add_errcode("ENOEXEC", ENOEXEC, "Exec format error");
336 : : #endif
337 : : #ifdef EALREADY
338 [ - + ]: 4 : add_errcode("EALREADY", EALREADY, "Operation already in progress");
339 : : #else
340 : : #ifdef WSAEALREADY
341 : : add_errcode("EALREADY", WSAEALREADY, "Operation already in progress");
342 : : #endif
343 : : #endif
344 : : #ifdef ENETDOWN
345 [ - + ]: 4 : add_errcode("ENETDOWN", ENETDOWN, "Network is down");
346 : : #else
347 : : #ifdef WSAENETDOWN
348 : : add_errcode("ENETDOWN", WSAENETDOWN, "Network is down");
349 : : #endif
350 : : #endif
351 : : #ifdef ENOTNAM
352 [ - + ]: 4 : add_errcode("ENOTNAM", ENOTNAM, "Not a XENIX named type file");
353 : : #endif
354 : : #ifdef EACCES
355 [ - + ]: 4 : add_errcode("EACCES", EACCES, "Permission denied");
356 : : #else
357 : : #ifdef WSAEACCES
358 : : add_errcode("EACCES", WSAEACCES, "Permission denied");
359 : : #endif
360 : : #endif
361 : : #ifdef ELNRNG
362 [ - + ]: 4 : add_errcode("ELNRNG", ELNRNG, "Link number out of range");
363 : : #endif
364 : : #ifdef EILSEQ
365 [ - + ]: 4 : add_errcode("EILSEQ", EILSEQ, "Illegal byte sequence");
366 : : #endif
367 : : #ifdef ENOTDIR
368 [ - + ]: 4 : add_errcode("ENOTDIR", ENOTDIR, "Not a directory");
369 : : #endif
370 : : #ifdef ENOTUNIQ
371 [ - + ]: 4 : add_errcode("ENOTUNIQ", ENOTUNIQ, "Name not unique on network");
372 : : #endif
373 : : #ifdef EPERM
374 [ - + ]: 4 : add_errcode("EPERM", EPERM, "Operation not permitted");
375 : : #endif
376 : : #ifdef EDOM
377 [ - + ]: 4 : add_errcode("EDOM", EDOM, "Math argument out of domain of func");
378 : : #endif
379 : : #ifdef EXFULL
380 [ - + ]: 4 : add_errcode("EXFULL", EXFULL, "Exchange full");
381 : : #endif
382 : : #ifdef ECONNREFUSED
383 [ - + ]: 4 : add_errcode("ECONNREFUSED", ECONNREFUSED, "Connection refused");
384 : : #else
385 : : #ifdef WSAECONNREFUSED
386 : : add_errcode("ECONNREFUSED", WSAECONNREFUSED, "Connection refused");
387 : : #endif
388 : : #endif
389 : : #ifdef EISDIR
390 [ - + ]: 4 : add_errcode("EISDIR", EISDIR, "Is a directory");
391 : : #endif
392 : : #ifdef EPROTONOSUPPORT
393 [ - + ]: 4 : add_errcode("EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported");
394 : : #else
395 : : #ifdef WSAEPROTONOSUPPORT
396 : : add_errcode("EPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
397 : : #endif
398 : : #endif
399 : : #ifdef EROFS
400 [ - + ]: 4 : add_errcode("EROFS", EROFS, "Read-only file system");
401 : : #endif
402 : : #ifdef EADDRNOTAVAIL
403 [ - + ]: 4 : add_errcode("EADDRNOTAVAIL", EADDRNOTAVAIL, "Cannot assign requested address");
404 : : #else
405 : : #ifdef WSAEADDRNOTAVAIL
406 : : add_errcode("EADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
407 : : #endif
408 : : #endif
409 : : #ifdef EIDRM
410 [ - + ]: 4 : add_errcode("EIDRM", EIDRM, "Identifier removed");
411 : : #endif
412 : : #ifdef ECOMM
413 [ - + ]: 4 : add_errcode("ECOMM", ECOMM, "Communication error on send");
414 : : #endif
415 : : #ifdef ESRMNT
416 [ - + ]: 4 : add_errcode("ESRMNT", ESRMNT, "Srmount error");
417 : : #endif
418 : : #ifdef EREMOTEIO
419 [ - + ]: 4 : add_errcode("EREMOTEIO", EREMOTEIO, "Remote I/O error");
420 : : #endif
421 : : #ifdef EL3RST
422 [ - + ]: 4 : add_errcode("EL3RST", EL3RST, "Level 3 reset");
423 : : #endif
424 : : #ifdef EBADMSG
425 [ - + ]: 4 : add_errcode("EBADMSG", EBADMSG, "Not a data message");
426 : : #endif
427 : : #ifdef ENFILE
428 [ - + ]: 4 : add_errcode("ENFILE", ENFILE, "File table overflow");
429 : : #endif
430 : : #ifdef ELIBMAX
431 [ - + ]: 4 : add_errcode("ELIBMAX", ELIBMAX, "Attempting to link in too many shared libraries");
432 : : #endif
433 : : #ifdef ESPIPE
434 [ - + ]: 4 : add_errcode("ESPIPE", ESPIPE, "Illegal seek");
435 : : #endif
436 : : #ifdef ENOLINK
437 [ - + ]: 4 : add_errcode("ENOLINK", ENOLINK, "Link has been severed");
438 : : #endif
439 : : #ifdef ENETRESET
440 [ - + ]: 4 : add_errcode("ENETRESET", ENETRESET, "Network dropped connection because of reset");
441 : : #else
442 : : #ifdef WSAENETRESET
443 : : add_errcode("ENETRESET", WSAENETRESET, "Network dropped connection because of reset");
444 : : #endif
445 : : #endif
446 : : #ifdef ETIMEDOUT
447 [ - + ]: 4 : add_errcode("ETIMEDOUT", ETIMEDOUT, "Connection timed out");
448 : : #else
449 : : #ifdef WSAETIMEDOUT
450 : : add_errcode("ETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
451 : : #endif
452 : : #endif
453 : : #ifdef ENOENT
454 [ - + ]: 4 : add_errcode("ENOENT", ENOENT, "No such file or directory");
455 : : #endif
456 : : #ifdef EEXIST
457 [ - + ]: 4 : add_errcode("EEXIST", EEXIST, "File exists");
458 : : #endif
459 : : #ifdef EDQUOT
460 [ - + ]: 4 : add_errcode("EDQUOT", EDQUOT, "Quota exceeded");
461 : : #else
462 : : #ifdef WSAEDQUOT
463 : : add_errcode("EDQUOT", WSAEDQUOT, "Quota exceeded");
464 : : #endif
465 : : #endif
466 : : #ifdef ENOSTR
467 [ - + ]: 4 : add_errcode("ENOSTR", ENOSTR, "Device not a stream");
468 : : #endif
469 : : #ifdef EBADSLT
470 [ - + ]: 4 : add_errcode("EBADSLT", EBADSLT, "Invalid slot");
471 : : #endif
472 : : #ifdef EBADRQC
473 [ - + ]: 4 : add_errcode("EBADRQC", EBADRQC, "Invalid request code");
474 : : #endif
475 : : #ifdef ELIBACC
476 [ - + ]: 4 : add_errcode("ELIBACC", ELIBACC, "Can not access a needed shared library");
477 : : #endif
478 : : #ifdef EFAULT
479 [ - + ]: 4 : add_errcode("EFAULT", EFAULT, "Bad address");
480 : : #else
481 : : #ifdef WSAEFAULT
482 : : add_errcode("EFAULT", WSAEFAULT, "Bad address");
483 : : #endif
484 : : #endif
485 : : #ifdef EFBIG
486 [ - + ]: 4 : add_errcode("EFBIG", EFBIG, "File too large");
487 : : #endif
488 : : #ifdef EDEADLK
489 [ - + ]: 4 : add_errcode("EDEADLK", EDEADLK, "Resource deadlock would occur");
490 : : #endif
491 : : #ifdef ENOTCONN
492 [ - + ]: 4 : add_errcode("ENOTCONN", ENOTCONN, "Transport endpoint is not connected");
493 : : #else
494 : : #ifdef WSAENOTCONN
495 : : add_errcode("ENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
496 : : #endif
497 : : #endif
498 : : #ifdef EDESTADDRREQ
499 [ - + ]: 4 : add_errcode("EDESTADDRREQ", EDESTADDRREQ, "Destination address required");
500 : : #else
501 : : #ifdef WSAEDESTADDRREQ
502 : : add_errcode("EDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
503 : : #endif
504 : : #endif
505 : : #ifdef ELIBSCN
506 [ - + ]: 4 : add_errcode("ELIBSCN", ELIBSCN, ".lib section in a.out corrupted");
507 : : #endif
508 : : #ifdef ENOLCK
509 [ - + ]: 4 : add_errcode("ENOLCK", ENOLCK, "No record locks available");
510 : : #endif
511 : : #ifdef EISNAM
512 [ - + ]: 4 : add_errcode("EISNAM", EISNAM, "Is a named type file");
513 : : #endif
514 : : #ifdef ECONNABORTED
515 [ - + ]: 4 : add_errcode("ECONNABORTED", ECONNABORTED, "Software caused connection abort");
516 : : #else
517 : : #ifdef WSAECONNABORTED
518 : : add_errcode("ECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
519 : : #endif
520 : : #endif
521 : : #ifdef ENETUNREACH
522 [ - + ]: 4 : add_errcode("ENETUNREACH", ENETUNREACH, "Network is unreachable");
523 : : #else
524 : : #ifdef WSAENETUNREACH
525 : : add_errcode("ENETUNREACH", WSAENETUNREACH, "Network is unreachable");
526 : : #endif
527 : : #endif
528 : : #ifdef ESTALE
529 [ - + ]: 4 : add_errcode("ESTALE", ESTALE, "Stale NFS file handle");
530 : : #else
531 : : #ifdef WSAESTALE
532 : : add_errcode("ESTALE", WSAESTALE, "Stale NFS file handle");
533 : : #endif
534 : : #endif
535 : : #ifdef ENOSR
536 [ - + ]: 4 : add_errcode("ENOSR", ENOSR, "Out of streams resources");
537 : : #endif
538 : : #ifdef ENOMEM
539 [ - + ]: 4 : add_errcode("ENOMEM", ENOMEM, "Out of memory");
540 : : #endif
541 : : #ifdef ENOTSOCK
542 [ - + ]: 4 : add_errcode("ENOTSOCK", ENOTSOCK, "Socket operation on non-socket");
543 : : #else
544 : : #ifdef WSAENOTSOCK
545 : : add_errcode("ENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
546 : : #endif
547 : : #endif
548 : : #ifdef ESTRPIPE
549 [ - + ]: 4 : add_errcode("ESTRPIPE", ESTRPIPE, "Streams pipe error");
550 : : #endif
551 : : #ifdef EMLINK
552 [ - + ]: 4 : add_errcode("EMLINK", EMLINK, "Too many links");
553 : : #endif
554 : : #ifdef ERANGE
555 [ - + ]: 4 : add_errcode("ERANGE", ERANGE, "Math result not representable");
556 : : #endif
557 : : #ifdef ELIBEXEC
558 [ - + ]: 4 : add_errcode("ELIBEXEC", ELIBEXEC, "Cannot exec a shared library directly");
559 : : #endif
560 : : #ifdef EL3HLT
561 [ - + ]: 4 : add_errcode("EL3HLT", EL3HLT, "Level 3 halted");
562 : : #endif
563 : : #ifdef ECONNRESET
564 [ - + ]: 4 : add_errcode("ECONNRESET", ECONNRESET, "Connection reset by peer");
565 : : #else
566 : : #ifdef WSAECONNRESET
567 : : add_errcode("ECONNRESET", WSAECONNRESET, "Connection reset by peer");
568 : : #endif
569 : : #endif
570 : : #ifdef EADDRINUSE
571 [ - + ]: 4 : add_errcode("EADDRINUSE", EADDRINUSE, "Address already in use");
572 : : #else
573 : : #ifdef WSAEADDRINUSE
574 : : add_errcode("EADDRINUSE", WSAEADDRINUSE, "Address already in use");
575 : : #endif
576 : : #endif
577 : : #ifdef EOPNOTSUPP
578 [ - + ]: 4 : add_errcode("EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on transport endpoint");
579 : : #else
580 : : #ifdef WSAEOPNOTSUPP
581 : : add_errcode("EOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
582 : : #endif
583 : : #endif
584 : : #ifdef EREMCHG
585 [ - + ]: 4 : add_errcode("EREMCHG", EREMCHG, "Remote address changed");
586 : : #endif
587 : : #ifdef EAGAIN
588 [ - + ]: 4 : add_errcode("EAGAIN", EAGAIN, "Try again");
589 : : #endif
590 : : #ifdef ENAMETOOLONG
591 [ - + ]: 4 : add_errcode("ENAMETOOLONG", ENAMETOOLONG, "File name too long");
592 : : #else
593 : : #ifdef WSAENAMETOOLONG
594 : : add_errcode("ENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
595 : : #endif
596 : : #endif
597 : : #ifdef ENOTTY
598 [ - + ]: 4 : add_errcode("ENOTTY", ENOTTY, "Not a typewriter");
599 : : #endif
600 : : #ifdef ERESTART
601 [ - + ]: 4 : add_errcode("ERESTART", ERESTART, "Interrupted system call should be restarted");
602 : : #endif
603 : : #ifdef ESOCKTNOSUPPORT
604 [ - + ]: 4 : add_errcode("ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, "Socket type not supported");
605 : : #else
606 : : #ifdef WSAESOCKTNOSUPPORT
607 : : add_errcode("ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
608 : : #endif
609 : : #endif
610 : : #ifdef ETIME
611 [ - + ]: 4 : add_errcode("ETIME", ETIME, "Timer expired");
612 : : #endif
613 : : #ifdef EBFONT
614 [ - + ]: 4 : add_errcode("EBFONT", EBFONT, "Bad font file format");
615 : : #endif
616 : : #ifdef EDEADLOCK
617 [ - + ]: 4 : add_errcode("EDEADLOCK", EDEADLOCK, "Error EDEADLOCK");
618 : : #endif
619 : : #ifdef ETOOMANYREFS
620 [ - + ]: 4 : add_errcode("ETOOMANYREFS", ETOOMANYREFS, "Too many references: cannot splice");
621 : : #else
622 : : #ifdef WSAETOOMANYREFS
623 : : add_errcode("ETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
624 : : #endif
625 : : #endif
626 : : #ifdef EMFILE
627 [ - + ]: 4 : add_errcode("EMFILE", EMFILE, "Too many open files");
628 : : #else
629 : : #ifdef WSAEMFILE
630 : : add_errcode("EMFILE", WSAEMFILE, "Too many open files");
631 : : #endif
632 : : #endif
633 : : #ifdef ETXTBSY
634 [ - + ]: 4 : add_errcode("ETXTBSY", ETXTBSY, "Text file busy");
635 : : #endif
636 : : #ifdef EINPROGRESS
637 [ - + ]: 4 : add_errcode("EINPROGRESS", EINPROGRESS, "Operation now in progress");
638 : : #else
639 : : #ifdef WSAEINPROGRESS
640 : : add_errcode("EINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
641 : : #endif
642 : : #endif
643 : : #ifdef ENXIO
644 [ - + ]: 4 : add_errcode("ENXIO", ENXIO, "No such device or address");
645 : : #endif
646 : : #ifdef ENOPKG
647 [ - + ]: 4 : add_errcode("ENOPKG", ENOPKG, "Package not installed");
648 : : #endif
649 : : #ifdef WSASY
650 : : add_errcode("WSASY", WSASY, "Error WSASY");
651 : : #endif
652 : : #ifdef WSAEHOSTDOWN
653 : : add_errcode("WSAEHOSTDOWN", WSAEHOSTDOWN, "Host is down");
654 : : #endif
655 : : #ifdef WSAENETDOWN
656 : : add_errcode("WSAENETDOWN", WSAENETDOWN, "Network is down");
657 : : #endif
658 : : #ifdef WSAENOTSOCK
659 : : add_errcode("WSAENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket");
660 : : #endif
661 : : #ifdef WSAEHOSTUNREACH
662 : : add_errcode("WSAEHOSTUNREACH", WSAEHOSTUNREACH, "No route to host");
663 : : #endif
664 : : #ifdef WSAELOOP
665 : : add_errcode("WSAELOOP", WSAELOOP, "Too many symbolic links encountered");
666 : : #endif
667 : : #ifdef WSAEMFILE
668 : : add_errcode("WSAEMFILE", WSAEMFILE, "Too many open files");
669 : : #endif
670 : : #ifdef WSAESTALE
671 : : add_errcode("WSAESTALE", WSAESTALE, "Stale NFS file handle");
672 : : #endif
673 : : #ifdef WSAVERNOTSUPPORTED
674 : : add_errcode("WSAVERNOTSUPPORTED", WSAVERNOTSUPPORTED, "Error WSAVERNOTSUPPORTED");
675 : : #endif
676 : : #ifdef WSAENETUNREACH
677 : : add_errcode("WSAENETUNREACH", WSAENETUNREACH, "Network is unreachable");
678 : : #endif
679 : : #ifdef WSAEPROCLIM
680 : : add_errcode("WSAEPROCLIM", WSAEPROCLIM, "Error WSAEPROCLIM");
681 : : #endif
682 : : #ifdef WSAEFAULT
683 : : add_errcode("WSAEFAULT", WSAEFAULT, "Bad address");
684 : : #endif
685 : : #ifdef WSANOTINITIALISED
686 : : add_errcode("WSANOTINITIALISED", WSANOTINITIALISED, "Error WSANOTINITIALISED");
687 : : #endif
688 : : #ifdef WSAEUSERS
689 : : add_errcode("WSAEUSERS", WSAEUSERS, "Too many users");
690 : : #endif
691 : : #ifdef WSAMAKEASYNCREPL
692 : : add_errcode("WSAMAKEASYNCREPL", WSAMAKEASYNCREPL, "Error WSAMAKEASYNCREPL");
693 : : #endif
694 : : #ifdef WSAENOPROTOOPT
695 : : add_errcode("WSAENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available");
696 : : #endif
697 : : #ifdef WSAECONNABORTED
698 : : add_errcode("WSAECONNABORTED", WSAECONNABORTED, "Software caused connection abort");
699 : : #endif
700 : : #ifdef WSAENAMETOOLONG
701 : : add_errcode("WSAENAMETOOLONG", WSAENAMETOOLONG, "File name too long");
702 : : #endif
703 : : #ifdef WSAENOTEMPTY
704 : : add_errcode("WSAENOTEMPTY", WSAENOTEMPTY, "Directory not empty");
705 : : #endif
706 : : #ifdef WSAESHUTDOWN
707 : : add_errcode("WSAESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown");
708 : : #endif
709 : : #ifdef WSAEAFNOSUPPORT
710 : : add_errcode("WSAEAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol");
711 : : #endif
712 : : #ifdef WSAETOOMANYREFS
713 : : add_errcode("WSAETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice");
714 : : #endif
715 : : #ifdef WSAEACCES
716 : : add_errcode("WSAEACCES", WSAEACCES, "Permission denied");
717 : : #endif
718 : : #ifdef WSATR
719 : : add_errcode("WSATR", WSATR, "Error WSATR");
720 : : #endif
721 : : #ifdef WSABASEERR
722 : : add_errcode("WSABASEERR", WSABASEERR, "Error WSABASEERR");
723 : : #endif
724 : : #ifdef WSADESCRIPTIO
725 : : add_errcode("WSADESCRIPTIO", WSADESCRIPTIO, "Error WSADESCRIPTIO");
726 : : #endif
727 : : #ifdef WSAEMSGSIZE
728 : : add_errcode("WSAEMSGSIZE", WSAEMSGSIZE, "Message too long");
729 : : #endif
730 : : #ifdef WSAEBADF
731 : : add_errcode("WSAEBADF", WSAEBADF, "Bad file number");
732 : : #endif
733 : : #ifdef WSAECONNRESET
734 : : add_errcode("WSAECONNRESET", WSAECONNRESET, "Connection reset by peer");
735 : : #endif
736 : : #ifdef WSAGETSELECTERRO
737 : : add_errcode("WSAGETSELECTERRO", WSAGETSELECTERRO, "Error WSAGETSELECTERRO");
738 : : #endif
739 : : #ifdef WSAETIMEDOUT
740 : : add_errcode("WSAETIMEDOUT", WSAETIMEDOUT, "Connection timed out");
741 : : #endif
742 : : #ifdef WSAENOBUFS
743 : : add_errcode("WSAENOBUFS", WSAENOBUFS, "No buffer space available");
744 : : #endif
745 : : #ifdef WSAEDISCON
746 : : add_errcode("WSAEDISCON", WSAEDISCON, "Error WSAEDISCON");
747 : : #endif
748 : : #ifdef WSAEINTR
749 : : add_errcode("WSAEINTR", WSAEINTR, "Interrupted system call");
750 : : #endif
751 : : #ifdef WSAEPROTOTYPE
752 : : add_errcode("WSAEPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket");
753 : : #endif
754 : : #ifdef WSAHOS
755 : : add_errcode("WSAHOS", WSAHOS, "Error WSAHOS");
756 : : #endif
757 : : #ifdef WSAEADDRINUSE
758 : : add_errcode("WSAEADDRINUSE", WSAEADDRINUSE, "Address already in use");
759 : : #endif
760 : : #ifdef WSAEADDRNOTAVAIL
761 : : add_errcode("WSAEADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address");
762 : : #endif
763 : : #ifdef WSAEALREADY
764 : : add_errcode("WSAEALREADY", WSAEALREADY, "Operation already in progress");
765 : : #endif
766 : : #ifdef WSAEPROTONOSUPPORT
767 : : add_errcode("WSAEPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported");
768 : : #endif
769 : : #ifdef WSASYSNOTREADY
770 : : add_errcode("WSASYSNOTREADY", WSASYSNOTREADY, "Error WSASYSNOTREADY");
771 : : #endif
772 : : #ifdef WSAEWOULDBLOCK
773 : : add_errcode("WSAEWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block");
774 : : #endif
775 : : #ifdef WSAEPFNOSUPPORT
776 : : add_errcode("WSAEPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported");
777 : : #endif
778 : : #ifdef WSAEOPNOTSUPP
779 : : add_errcode("WSAEOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint");
780 : : #endif
781 : : #ifdef WSAEISCONN
782 : : add_errcode("WSAEISCONN", WSAEISCONN, "Transport endpoint is already connected");
783 : : #endif
784 : : #ifdef WSAEDQUOT
785 : : add_errcode("WSAEDQUOT", WSAEDQUOT, "Quota exceeded");
786 : : #endif
787 : : #ifdef WSAENOTCONN
788 : : add_errcode("WSAENOTCONN", WSAENOTCONN, "Transport endpoint is not connected");
789 : : #endif
790 : : #ifdef WSAEREMOTE
791 : : add_errcode("WSAEREMOTE", WSAEREMOTE, "Object is remote");
792 : : #endif
793 : : #ifdef WSAEINVAL
794 : : add_errcode("WSAEINVAL", WSAEINVAL, "Invalid argument");
795 : : #endif
796 : : #ifdef WSAEINPROGRESS
797 : : add_errcode("WSAEINPROGRESS", WSAEINPROGRESS, "Operation now in progress");
798 : : #endif
799 : : #ifdef WSAGETSELECTEVEN
800 : : add_errcode("WSAGETSELECTEVEN", WSAGETSELECTEVEN, "Error WSAGETSELECTEVEN");
801 : : #endif
802 : : #ifdef WSAESOCKTNOSUPPORT
803 : : add_errcode("WSAESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported");
804 : : #endif
805 : : #ifdef WSAGETASYNCERRO
806 : : add_errcode("WSAGETASYNCERRO", WSAGETASYNCERRO, "Error WSAGETASYNCERRO");
807 : : #endif
808 : : #ifdef WSAMAKESELECTREPL
809 : : add_errcode("WSAMAKESELECTREPL", WSAMAKESELECTREPL, "Error WSAMAKESELECTREPL");
810 : : #endif
811 : : #ifdef WSAGETASYNCBUFLE
812 : : add_errcode("WSAGETASYNCBUFLE", WSAGETASYNCBUFLE, "Error WSAGETASYNCBUFLE");
813 : : #endif
814 : : #ifdef WSAEDESTADDRREQ
815 : : add_errcode("WSAEDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required");
816 : : #endif
817 : : #ifdef WSAECONNREFUSED
818 : : add_errcode("WSAECONNREFUSED", WSAECONNREFUSED, "Connection refused");
819 : : #endif
820 : : #ifdef WSAENETRESET
821 : : add_errcode("WSAENETRESET", WSAENETRESET, "Network dropped connection because of reset");
822 : : #endif
823 : : #ifdef WSAN
824 : : add_errcode("WSAN", WSAN, "Error WSAN");
825 : : #endif
826 : : #ifdef ENOMEDIUM
827 [ - + ]: 4 : add_errcode("ENOMEDIUM", ENOMEDIUM, "No medium found");
828 : : #endif
829 : : #ifdef EMEDIUMTYPE
830 [ - + ]: 4 : add_errcode("EMEDIUMTYPE", EMEDIUMTYPE, "Wrong medium type");
831 : : #endif
832 : : #ifdef ECANCELED
833 [ - + ]: 4 : add_errcode("ECANCELED", ECANCELED, "Operation Canceled");
834 : : #endif
835 : : #ifdef ENOKEY
836 [ - + ]: 4 : add_errcode("ENOKEY", ENOKEY, "Required key not available");
837 : : #endif
838 : : #ifdef EKEYEXPIRED
839 [ - + ]: 4 : add_errcode("EKEYEXPIRED", EKEYEXPIRED, "Key has expired");
840 : : #endif
841 : : #ifdef EKEYREVOKED
842 [ - + ]: 4 : add_errcode("EKEYREVOKED", EKEYREVOKED, "Key has been revoked");
843 : : #endif
844 : : #ifdef EKEYREJECTED
845 [ - + ]: 4 : add_errcode("EKEYREJECTED", EKEYREJECTED, "Key was rejected by service");
846 : : #endif
847 : : #ifdef EOWNERDEAD
848 [ - + ]: 4 : add_errcode("EOWNERDEAD", EOWNERDEAD, "Owner died");
849 : : #endif
850 : : #ifdef ENOTRECOVERABLE
851 [ - + ]: 4 : add_errcode("ENOTRECOVERABLE", ENOTRECOVERABLE, "State not recoverable");
852 : : #endif
853 : : #ifdef ERFKILL
854 [ - + ]: 4 : add_errcode("ERFKILL", ERFKILL, "Operation not possible due to RF-kill");
855 : : #endif
856 : :
857 : : /* Solaris-specific errnos */
858 : : #ifdef ECANCELED
859 [ - + ]: 4 : add_errcode("ECANCELED", ECANCELED, "Operation canceled");
860 : : #endif
861 : : #ifdef ENOTSUP
862 [ - + ]: 4 : add_errcode("ENOTSUP", ENOTSUP, "Operation not supported");
863 : : #endif
864 : : #ifdef EOWNERDEAD
865 [ - + ]: 4 : add_errcode("EOWNERDEAD", EOWNERDEAD, "Process died with the lock");
866 : : #endif
867 : : #ifdef ENOTRECOVERABLE
868 [ - + ]: 4 : add_errcode("ENOTRECOVERABLE", ENOTRECOVERABLE, "Lock is not recoverable");
869 : : #endif
870 : : #ifdef ELOCKUNMAPPED
871 : : add_errcode("ELOCKUNMAPPED", ELOCKUNMAPPED, "Locked lock was unmapped");
872 : : #endif
873 : : #ifdef ENOTACTIVE
874 : : add_errcode("ENOTACTIVE", ENOTACTIVE, "Facility is not active");
875 : : #endif
876 : :
877 : : /* MacOSX specific errnos */
878 : : #ifdef EAUTH
879 : : add_errcode("EAUTH", EAUTH, "Authentication error");
880 : : #endif
881 : : #ifdef EBADARCH
882 : : add_errcode("EBADARCH", EBADARCH, "Bad CPU type in executable");
883 : : #endif
884 : : #ifdef EBADEXEC
885 : : add_errcode("EBADEXEC", EBADEXEC, "Bad executable (or shared library)");
886 : : #endif
887 : : #ifdef EBADMACHO
888 : : add_errcode("EBADMACHO", EBADMACHO, "Malformed Mach-o file");
889 : : #endif
890 : : #ifdef EBADRPC
891 : : add_errcode("EBADRPC", EBADRPC, "RPC struct is bad");
892 : : #endif
893 : : #ifdef EDEVERR
894 : : add_errcode("EDEVERR", EDEVERR, "Device error");
895 : : #endif
896 : : #ifdef EFTYPE
897 : : add_errcode("EFTYPE", EFTYPE, "Inappropriate file type or format");
898 : : #endif
899 : : #ifdef ENEEDAUTH
900 : : add_errcode("ENEEDAUTH", ENEEDAUTH, "Need authenticator");
901 : : #endif
902 : : #ifdef ENOATTR
903 : : add_errcode("ENOATTR", ENOATTR, "Attribute not found");
904 : : #endif
905 : : #ifdef ENOPOLICY
906 : : add_errcode("ENOPOLICY", ENOPOLICY, "Policy not found");
907 : : #endif
908 : : #ifdef EPROCLIM
909 : : add_errcode("EPROCLIM", EPROCLIM, "Too many processes");
910 : : #endif
911 : : #ifdef EPROCUNAVAIL
912 : : add_errcode("EPROCUNAVAIL", EPROCUNAVAIL, "Bad procedure for program");
913 : : #endif
914 : : #ifdef EPROGMISMATCH
915 : : add_errcode("EPROGMISMATCH", EPROGMISMATCH, "Program version wrong");
916 : : #endif
917 : : #ifdef EPROGUNAVAIL
918 : : add_errcode("EPROGUNAVAIL", EPROGUNAVAIL, "RPC prog. not avail");
919 : : #endif
920 : : #ifdef EPWROFF
921 : : add_errcode("EPWROFF", EPWROFF, "Device power is off");
922 : : #endif
923 : : #ifdef ERPCMISMATCH
924 : : add_errcode("ERPCMISMATCH", ERPCMISMATCH, "RPC version wrong");
925 : : #endif
926 : : #ifdef ESHLIBVERS
927 : : add_errcode("ESHLIBVERS", ESHLIBVERS, "Shared library version mismatch");
928 : : #endif
929 : : #ifdef EQFULL
930 : : add_errcode("EQFULL", EQFULL, "Interface output queue is full");
931 : : #endif
932 : : #ifdef ENOTCAPABLE
933 : : // WASI extension
934 : : add_errcode("ENOTCAPABLE", ENOTCAPABLE, "Capabilities insufficient");
935 : : #endif
936 : :
937 : 4 : Py_DECREF(error_dict);
938 : 4 : return 0;
939 : : }
940 : :
941 : : static PyModuleDef_Slot errno_slots[] = {
942 : : {Py_mod_exec, errno_exec},
943 : : {0, NULL}
944 : : };
945 : :
946 : : PyDoc_STRVAR(errno__doc__,
947 : : "This module makes available standard errno system symbols.\n\
948 : : \n\
949 : : The value of each symbol is the corresponding integer value,\n\
950 : : e.g., on most systems, errno.ENOENT equals the integer 2.\n\
951 : : \n\
952 : : The dictionary errno.errorcode maps numeric codes to symbol names,\n\
953 : : e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\
954 : : \n\
955 : : Symbols that are not relevant to the underlying system are not defined.\n\
956 : : \n\
957 : : To map error codes to error messages, use the function os.strerror(),\n\
958 : : e.g. os.strerror(2) could return 'No such file or directory'.");
959 : :
960 : : static struct PyModuleDef errnomodule = {
961 : : PyModuleDef_HEAD_INIT,
962 : : .m_name = "errno",
963 : : .m_doc = errno__doc__,
964 : : .m_size = 0,
965 : : .m_methods = errno_methods,
966 : : .m_slots = errno_slots,
967 : : };
968 : :
969 : : PyMODINIT_FUNC
970 : 4 : PyInit_errno(void)
971 : : {
972 : 4 : return PyModuleDef_Init(&errnomodule);
973 : : }
|