1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 #include "pycore_modsupport.h" // _PyArg_CheckPositional()
6
7 PyDoc_STRVAR(msvcrt_heapmin__doc__,
8 "heapmin($module, /)\n"
9 "--\n"
10 "\n"
11 "Minimize the malloc() heap.\n"
12 "\n"
13 "Force the malloc() heap to clean itself up and return unused blocks\n"
14 "to the operating system. On failure, this raises OSError.");
15
16 #define MSVCRT_HEAPMIN_METHODDEF \
17 {"heapmin", (PyCFunction)msvcrt_heapmin, METH_NOARGS, msvcrt_heapmin__doc__},
18
19 static PyObject *
20 msvcrt_heapmin_impl(PyObject *module);
21
22 static PyObject *
msvcrt_heapmin(PyObject * module,PyObject * Py_UNUSED (ignored))23 msvcrt_heapmin(PyObject *module, PyObject *Py_UNUSED(ignored))
24 {
25 return msvcrt_heapmin_impl(module);
26 }
27
28 PyDoc_STRVAR(msvcrt_locking__doc__,
29 "locking($module, fd, mode, nbytes, /)\n"
30 "--\n"
31 "\n"
32 "Lock part of a file based on file descriptor fd from the C runtime.\n"
33 "\n"
34 "Raises OSError on failure. The locked region of the file extends from\n"
35 "the current file position for nbytes bytes, and may continue beyond\n"
36 "the end of the file. mode must be one of the LK_* constants listed\n"
37 "below. Multiple regions in a file may be locked at the same time, but\n"
38 "may not overlap. Adjacent regions are not merged; they must be unlocked\n"
39 "individually.");
40
41 #define MSVCRT_LOCKING_METHODDEF \
42 {"locking", _PyCFunction_CAST(msvcrt_locking), METH_FASTCALL, msvcrt_locking__doc__},
43
44 static PyObject *
45 msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes);
46
47 static PyObject *
msvcrt_locking(PyObject * module,PyObject * const * args,Py_ssize_t nargs)48 msvcrt_locking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
49 {
50 PyObject *return_value = NULL;
51 int fd;
52 int mode;
53 long nbytes;
54
55 if (!_PyArg_CheckPositional("locking", nargs, 3, 3)) {
56 goto exit;
57 }
58 fd = PyLong_AsInt(args[0]);
59 if (fd == -1 && PyErr_Occurred()) {
60 goto exit;
61 }
62 mode = PyLong_AsInt(args[1]);
63 if (mode == -1 && PyErr_Occurred()) {
64 goto exit;
65 }
66 nbytes = PyLong_AsLong(args[2]);
67 if (nbytes == -1 && PyErr_Occurred()) {
68 goto exit;
69 }
70 return_value = msvcrt_locking_impl(module, fd, mode, nbytes);
71
72 exit:
73 return return_value;
74 }
75
76 PyDoc_STRVAR(msvcrt_setmode__doc__,
77 "setmode($module, fd, mode, /)\n"
78 "--\n"
79 "\n"
80 "Set the line-end translation mode for the file descriptor fd.\n"
81 "\n"
82 "To set it to text mode, flags should be os.O_TEXT; for binary, it\n"
83 "should be os.O_BINARY.\n"
84 "\n"
85 "Return value is the previous mode.");
86
87 #define MSVCRT_SETMODE_METHODDEF \
88 {"setmode", _PyCFunction_CAST(msvcrt_setmode), METH_FASTCALL, msvcrt_setmode__doc__},
89
90 static long
91 msvcrt_setmode_impl(PyObject *module, int fd, int flags);
92
93 static PyObject *
msvcrt_setmode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)94 msvcrt_setmode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
95 {
96 PyObject *return_value = NULL;
97 int fd;
98 int flags;
99 long _return_value;
100
101 if (!_PyArg_CheckPositional("setmode", nargs, 2, 2)) {
102 goto exit;
103 }
104 fd = PyLong_AsInt(args[0]);
105 if (fd == -1 && PyErr_Occurred()) {
106 goto exit;
107 }
108 flags = PyLong_AsInt(args[1]);
109 if (flags == -1 && PyErr_Occurred()) {
110 goto exit;
111 }
112 _return_value = msvcrt_setmode_impl(module, fd, flags);
113 if ((_return_value == -1) && PyErr_Occurred()) {
114 goto exit;
115 }
116 return_value = PyLong_FromLong(_return_value);
117
118 exit:
119 return return_value;
120 }
121
122 PyDoc_STRVAR(msvcrt_open_osfhandle__doc__,
123 "open_osfhandle($module, handle, flags, /)\n"
124 "--\n"
125 "\n"
126 "Create a C runtime file descriptor from the file handle handle.\n"
127 "\n"
128 "The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,\n"
129 "and os.O_TEXT. The returned file descriptor may be used as a parameter\n"
130 "to os.fdopen() to create a file object.");
131
132 #define MSVCRT_OPEN_OSFHANDLE_METHODDEF \
133 {"open_osfhandle", _PyCFunction_CAST(msvcrt_open_osfhandle), METH_FASTCALL, msvcrt_open_osfhandle__doc__},
134
135 static long
136 msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags);
137
138 static PyObject *
msvcrt_open_osfhandle(PyObject * module,PyObject * const * args,Py_ssize_t nargs)139 msvcrt_open_osfhandle(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
140 {
141 PyObject *return_value = NULL;
142 void *handle;
143 int flags;
144 long _return_value;
145
146 if (!_PyArg_CheckPositional("open_osfhandle", nargs, 2, 2)) {
147 goto exit;
148 }
149 handle = PyLong_AsVoidPtr(args[0]);
150 if (!handle && PyErr_Occurred()) {
151 goto exit;
152 }
153 flags = PyLong_AsInt(args[1]);
154 if (flags == -1 && PyErr_Occurred()) {
155 goto exit;
156 }
157 _return_value = msvcrt_open_osfhandle_impl(module, handle, flags);
158 if ((_return_value == -1) && PyErr_Occurred()) {
159 goto exit;
160 }
161 return_value = PyLong_FromLong(_return_value);
162
163 exit:
164 return return_value;
165 }
166
167 PyDoc_STRVAR(msvcrt_get_osfhandle__doc__,
168 "get_osfhandle($module, fd, /)\n"
169 "--\n"
170 "\n"
171 "Return the file handle for the file descriptor fd.\n"
172 "\n"
173 "Raises OSError if fd is not recognized.");
174
175 #define MSVCRT_GET_OSFHANDLE_METHODDEF \
176 {"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__},
177
178 static void *
179 msvcrt_get_osfhandle_impl(PyObject *module, int fd);
180
181 static PyObject *
msvcrt_get_osfhandle(PyObject * module,PyObject * arg)182 msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
183 {
184 PyObject *return_value = NULL;
185 int fd;
186 void *_return_value;
187
188 fd = PyLong_AsInt(arg);
189 if (fd == -1 && PyErr_Occurred()) {
190 goto exit;
191 }
192 _return_value = msvcrt_get_osfhandle_impl(module, fd);
193 if ((_return_value == NULL || _return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
194 goto exit;
195 }
196 return_value = PyLong_FromVoidPtr(_return_value);
197
198 exit:
199 return return_value;
200 }
201
202 PyDoc_STRVAR(msvcrt_kbhit__doc__,
203 "kbhit($module, /)\n"
204 "--\n"
205 "\n"
206 "Returns a nonzero value if a keypress is waiting to be read. Otherwise, return 0.");
207
208 #define MSVCRT_KBHIT_METHODDEF \
209 {"kbhit", (PyCFunction)msvcrt_kbhit, METH_NOARGS, msvcrt_kbhit__doc__},
210
211 static long
212 msvcrt_kbhit_impl(PyObject *module);
213
214 static PyObject *
msvcrt_kbhit(PyObject * module,PyObject * Py_UNUSED (ignored))215 msvcrt_kbhit(PyObject *module, PyObject *Py_UNUSED(ignored))
216 {
217 PyObject *return_value = NULL;
218 long _return_value;
219
220 _return_value = msvcrt_kbhit_impl(module);
221 if ((_return_value == -1) && PyErr_Occurred()) {
222 goto exit;
223 }
224 return_value = PyLong_FromLong(_return_value);
225
226 exit:
227 return return_value;
228 }
229
230 PyDoc_STRVAR(msvcrt_getch__doc__,
231 "getch($module, /)\n"
232 "--\n"
233 "\n"
234 "Read a keypress and return the resulting character as a byte string.\n"
235 "\n"
236 "Nothing is echoed to the console. This call will block if a keypress is\n"
237 "not already available, but will not wait for Enter to be pressed. If the\n"
238 "pressed key was a special function key, this will return \'\\000\' or\n"
239 "\'\\xe0\'; the next call will return the keycode. The Control-C keypress\n"
240 "cannot be read with this function.");
241
242 #define MSVCRT_GETCH_METHODDEF \
243 {"getch", (PyCFunction)msvcrt_getch, METH_NOARGS, msvcrt_getch__doc__},
244
245 static int
246 msvcrt_getch_impl(PyObject *module);
247
248 static PyObject *
msvcrt_getch(PyObject * module,PyObject * Py_UNUSED (ignored))249 msvcrt_getch(PyObject *module, PyObject *Py_UNUSED(ignored))
250 {
251 PyObject *return_value = NULL;
252 char s[1];
253
254 s[0] = msvcrt_getch_impl(module);
255 return_value = PyBytes_FromStringAndSize(s, 1);
256
257 return return_value;
258 }
259
260 #if defined(MS_WINDOWS_DESKTOP)
261
262 PyDoc_STRVAR(msvcrt_getwch__doc__,
263 "getwch($module, /)\n"
264 "--\n"
265 "\n"
266 "Wide char variant of getch(), returning a Unicode value.");
267
268 #define MSVCRT_GETWCH_METHODDEF \
269 {"getwch", (PyCFunction)msvcrt_getwch, METH_NOARGS, msvcrt_getwch__doc__},
270
271 static wchar_t
272 msvcrt_getwch_impl(PyObject *module);
273
274 static PyObject *
msvcrt_getwch(PyObject * module,PyObject * Py_UNUSED (ignored))275 msvcrt_getwch(PyObject *module, PyObject *Py_UNUSED(ignored))
276 {
277 PyObject *return_value = NULL;
278 wchar_t _return_value;
279
280 _return_value = msvcrt_getwch_impl(module);
281 return_value = PyUnicode_FromOrdinal(_return_value);
282
283 return return_value;
284 }
285
286 #endif /* defined(MS_WINDOWS_DESKTOP) */
287
288 PyDoc_STRVAR(msvcrt_getche__doc__,
289 "getche($module, /)\n"
290 "--\n"
291 "\n"
292 "Similar to getch(), but the keypress will be echoed if possible.");
293
294 #define MSVCRT_GETCHE_METHODDEF \
295 {"getche", (PyCFunction)msvcrt_getche, METH_NOARGS, msvcrt_getche__doc__},
296
297 static int
298 msvcrt_getche_impl(PyObject *module);
299
300 static PyObject *
msvcrt_getche(PyObject * module,PyObject * Py_UNUSED (ignored))301 msvcrt_getche(PyObject *module, PyObject *Py_UNUSED(ignored))
302 {
303 PyObject *return_value = NULL;
304 char s[1];
305
306 s[0] = msvcrt_getche_impl(module);
307 return_value = PyBytes_FromStringAndSize(s, 1);
308
309 return return_value;
310 }
311
312 #if defined(MS_WINDOWS_DESKTOP)
313
314 PyDoc_STRVAR(msvcrt_getwche__doc__,
315 "getwche($module, /)\n"
316 "--\n"
317 "\n"
318 "Wide char variant of getche(), returning a Unicode value.");
319
320 #define MSVCRT_GETWCHE_METHODDEF \
321 {"getwche", (PyCFunction)msvcrt_getwche, METH_NOARGS, msvcrt_getwche__doc__},
322
323 static wchar_t
324 msvcrt_getwche_impl(PyObject *module);
325
326 static PyObject *
msvcrt_getwche(PyObject * module,PyObject * Py_UNUSED (ignored))327 msvcrt_getwche(PyObject *module, PyObject *Py_UNUSED(ignored))
328 {
329 PyObject *return_value = NULL;
330 wchar_t _return_value;
331
332 _return_value = msvcrt_getwche_impl(module);
333 return_value = PyUnicode_FromOrdinal(_return_value);
334
335 return return_value;
336 }
337
338 #endif /* defined(MS_WINDOWS_DESKTOP) */
339
340 PyDoc_STRVAR(msvcrt_putch__doc__,
341 "putch($module, char, /)\n"
342 "--\n"
343 "\n"
344 "Print the byte string char to the console without buffering.");
345
346 #define MSVCRT_PUTCH_METHODDEF \
347 {"putch", (PyCFunction)msvcrt_putch, METH_O, msvcrt_putch__doc__},
348
349 static PyObject *
350 msvcrt_putch_impl(PyObject *module, char char_value);
351
352 static PyObject *
msvcrt_putch(PyObject * module,PyObject * arg)353 msvcrt_putch(PyObject *module, PyObject *arg)
354 {
355 PyObject *return_value = NULL;
356 char char_value;
357
358 if (PyBytes_Check(arg) && PyBytes_GET_SIZE(arg) == 1) {
359 char_value = PyBytes_AS_STRING(arg)[0];
360 }
361 else if (PyByteArray_Check(arg) && PyByteArray_GET_SIZE(arg) == 1) {
362 char_value = PyByteArray_AS_STRING(arg)[0];
363 }
364 else {
365 _PyArg_BadArgument("putch", "argument", "a byte string of length 1", arg);
366 goto exit;
367 }
368 return_value = msvcrt_putch_impl(module, char_value);
369
370 exit:
371 return return_value;
372 }
373
374 #if defined(MS_WINDOWS_DESKTOP)
375
376 PyDoc_STRVAR(msvcrt_putwch__doc__,
377 "putwch($module, unicode_char, /)\n"
378 "--\n"
379 "\n"
380 "Wide char variant of putch(), accepting a Unicode value.");
381
382 #define MSVCRT_PUTWCH_METHODDEF \
383 {"putwch", (PyCFunction)msvcrt_putwch, METH_O, msvcrt_putwch__doc__},
384
385 static PyObject *
386 msvcrt_putwch_impl(PyObject *module, int unicode_char);
387
388 static PyObject *
msvcrt_putwch(PyObject * module,PyObject * arg)389 msvcrt_putwch(PyObject *module, PyObject *arg)
390 {
391 PyObject *return_value = NULL;
392 int unicode_char;
393
394 if (!PyUnicode_Check(arg)) {
395 _PyArg_BadArgument("putwch", "argument", "a unicode character", arg);
396 goto exit;
397 }
398 if (PyUnicode_GET_LENGTH(arg) != 1) {
399 _PyArg_BadArgument("putwch", "argument", "a unicode character", arg);
400 goto exit;
401 }
402 unicode_char = PyUnicode_READ_CHAR(arg, 0);
403 return_value = msvcrt_putwch_impl(module, unicode_char);
404
405 exit:
406 return return_value;
407 }
408
409 #endif /* defined(MS_WINDOWS_DESKTOP) */
410
411 PyDoc_STRVAR(msvcrt_ungetch__doc__,
412 "ungetch($module, char, /)\n"
413 "--\n"
414 "\n"
415 "Opposite of getch.\n"
416 "\n"
417 "Cause the byte string char to be \"pushed back\" into the\n"
418 "console buffer; it will be the next character read by\n"
419 "getch() or getche().");
420
421 #define MSVCRT_UNGETCH_METHODDEF \
422 {"ungetch", (PyCFunction)msvcrt_ungetch, METH_O, msvcrt_ungetch__doc__},
423
424 static PyObject *
425 msvcrt_ungetch_impl(PyObject *module, char char_value);
426
427 static PyObject *
msvcrt_ungetch(PyObject * module,PyObject * arg)428 msvcrt_ungetch(PyObject *module, PyObject *arg)
429 {
430 PyObject *return_value = NULL;
431 char char_value;
432
433 if (PyBytes_Check(arg) && PyBytes_GET_SIZE(arg) == 1) {
434 char_value = PyBytes_AS_STRING(arg)[0];
435 }
436 else if (PyByteArray_Check(arg) && PyByteArray_GET_SIZE(arg) == 1) {
437 char_value = PyByteArray_AS_STRING(arg)[0];
438 }
439 else {
440 _PyArg_BadArgument("ungetch", "argument", "a byte string of length 1", arg);
441 goto exit;
442 }
443 return_value = msvcrt_ungetch_impl(module, char_value);
444
445 exit:
446 return return_value;
447 }
448
449 #if defined(MS_WINDOWS_DESKTOP)
450
451 PyDoc_STRVAR(msvcrt_ungetwch__doc__,
452 "ungetwch($module, unicode_char, /)\n"
453 "--\n"
454 "\n"
455 "Wide char variant of ungetch(), accepting a Unicode value.");
456
457 #define MSVCRT_UNGETWCH_METHODDEF \
458 {"ungetwch", (PyCFunction)msvcrt_ungetwch, METH_O, msvcrt_ungetwch__doc__},
459
460 static PyObject *
461 msvcrt_ungetwch_impl(PyObject *module, int unicode_char);
462
463 static PyObject *
msvcrt_ungetwch(PyObject * module,PyObject * arg)464 msvcrt_ungetwch(PyObject *module, PyObject *arg)
465 {
466 PyObject *return_value = NULL;
467 int unicode_char;
468
469 if (!PyUnicode_Check(arg)) {
470 _PyArg_BadArgument("ungetwch", "argument", "a unicode character", arg);
471 goto exit;
472 }
473 if (PyUnicode_GET_LENGTH(arg) != 1) {
474 _PyArg_BadArgument("ungetwch", "argument", "a unicode character", arg);
475 goto exit;
476 }
477 unicode_char = PyUnicode_READ_CHAR(arg, 0);
478 return_value = msvcrt_ungetwch_impl(module, unicode_char);
479
480 exit:
481 return return_value;
482 }
483
484 #endif /* defined(MS_WINDOWS_DESKTOP) */
485
486 #if defined(_DEBUG)
487
488 PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__,
489 "CrtSetReportFile($module, type, file, /)\n"
490 "--\n"
491 "\n"
492 "Wrapper around _CrtSetReportFile.\n"
493 "\n"
494 "Only available on Debug builds.");
495
496 #define MSVCRT_CRTSETREPORTFILE_METHODDEF \
497 {"CrtSetReportFile", _PyCFunction_CAST(msvcrt_CrtSetReportFile), METH_FASTCALL, msvcrt_CrtSetReportFile__doc__},
498
499 static void *
500 msvcrt_CrtSetReportFile_impl(PyObject *module, int type, void *file);
501
502 static PyObject *
msvcrt_CrtSetReportFile(PyObject * module,PyObject * const * args,Py_ssize_t nargs)503 msvcrt_CrtSetReportFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
504 {
505 PyObject *return_value = NULL;
506 int type;
507 void *file;
508 void *_return_value;
509
510 if (!_PyArg_CheckPositional("CrtSetReportFile", nargs, 2, 2)) {
511 goto exit;
512 }
513 type = PyLong_AsInt(args[0]);
514 if (type == -1 && PyErr_Occurred()) {
515 goto exit;
516 }
517 file = PyLong_AsVoidPtr(args[1]);
518 if (!file && PyErr_Occurred()) {
519 goto exit;
520 }
521 _return_value = msvcrt_CrtSetReportFile_impl(module, type, file);
522 if ((_return_value == NULL || _return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
523 goto exit;
524 }
525 return_value = PyLong_FromVoidPtr(_return_value);
526
527 exit:
528 return return_value;
529 }
530
531 #endif /* defined(_DEBUG) */
532
533 #if defined(_DEBUG)
534
535 PyDoc_STRVAR(msvcrt_CrtSetReportMode__doc__,
536 "CrtSetReportMode($module, type, mode, /)\n"
537 "--\n"
538 "\n"
539 "Wrapper around _CrtSetReportMode.\n"
540 "\n"
541 "Only available on Debug builds.");
542
543 #define MSVCRT_CRTSETREPORTMODE_METHODDEF \
544 {"CrtSetReportMode", _PyCFunction_CAST(msvcrt_CrtSetReportMode), METH_FASTCALL, msvcrt_CrtSetReportMode__doc__},
545
546 static long
547 msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode);
548
549 static PyObject *
msvcrt_CrtSetReportMode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)550 msvcrt_CrtSetReportMode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
551 {
552 PyObject *return_value = NULL;
553 int type;
554 int mode;
555 long _return_value;
556
557 if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) {
558 goto exit;
559 }
560 type = PyLong_AsInt(args[0]);
561 if (type == -1 && PyErr_Occurred()) {
562 goto exit;
563 }
564 mode = PyLong_AsInt(args[1]);
565 if (mode == -1 && PyErr_Occurred()) {
566 goto exit;
567 }
568 _return_value = msvcrt_CrtSetReportMode_impl(module, type, mode);
569 if ((_return_value == -1) && PyErr_Occurred()) {
570 goto exit;
571 }
572 return_value = PyLong_FromLong(_return_value);
573
574 exit:
575 return return_value;
576 }
577
578 #endif /* defined(_DEBUG) */
579
580 #if defined(_DEBUG)
581
582 PyDoc_STRVAR(msvcrt_set_error_mode__doc__,
583 "set_error_mode($module, mode, /)\n"
584 "--\n"
585 "\n"
586 "Wrapper around _set_error_mode.\n"
587 "\n"
588 "Only available on Debug builds.");
589
590 #define MSVCRT_SET_ERROR_MODE_METHODDEF \
591 {"set_error_mode", (PyCFunction)msvcrt_set_error_mode, METH_O, msvcrt_set_error_mode__doc__},
592
593 static long
594 msvcrt_set_error_mode_impl(PyObject *module, int mode);
595
596 static PyObject *
msvcrt_set_error_mode(PyObject * module,PyObject * arg)597 msvcrt_set_error_mode(PyObject *module, PyObject *arg)
598 {
599 PyObject *return_value = NULL;
600 int mode;
601 long _return_value;
602
603 mode = PyLong_AsInt(arg);
604 if (mode == -1 && PyErr_Occurred()) {
605 goto exit;
606 }
607 _return_value = msvcrt_set_error_mode_impl(module, mode);
608 if ((_return_value == -1) && PyErr_Occurred()) {
609 goto exit;
610 }
611 return_value = PyLong_FromLong(_return_value);
612
613 exit:
614 return return_value;
615 }
616
617 #endif /* defined(_DEBUG) */
618
619 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM))
620
621 PyDoc_STRVAR(msvcrt_GetErrorMode__doc__,
622 "GetErrorMode($module, /)\n"
623 "--\n"
624 "\n"
625 "Wrapper around GetErrorMode.");
626
627 #define MSVCRT_GETERRORMODE_METHODDEF \
628 {"GetErrorMode", (PyCFunction)msvcrt_GetErrorMode, METH_NOARGS, msvcrt_GetErrorMode__doc__},
629
630 static PyObject *
631 msvcrt_GetErrorMode_impl(PyObject *module);
632
633 static PyObject *
msvcrt_GetErrorMode(PyObject * module,PyObject * Py_UNUSED (ignored))634 msvcrt_GetErrorMode(PyObject *module, PyObject *Py_UNUSED(ignored))
635 {
636 return msvcrt_GetErrorMode_impl(module);
637 }
638
639 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)) */
640
641 PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
642 "SetErrorMode($module, mode, /)\n"
643 "--\n"
644 "\n"
645 "Wrapper around SetErrorMode.");
646
647 #define MSVCRT_SETERRORMODE_METHODDEF \
648 {"SetErrorMode", (PyCFunction)msvcrt_SetErrorMode, METH_O, msvcrt_SetErrorMode__doc__},
649
650 static PyObject *
651 msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode);
652
653 static PyObject *
msvcrt_SetErrorMode(PyObject * module,PyObject * arg)654 msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
655 {
656 PyObject *return_value = NULL;
657 unsigned int mode;
658
659 mode = (unsigned int)PyLong_AsUnsignedLongMask(arg);
660 if (mode == (unsigned int)-1 && PyErr_Occurred()) {
661 goto exit;
662 }
663 return_value = msvcrt_SetErrorMode_impl(module, mode);
664
665 exit:
666 return return_value;
667 }
668
669 #ifndef MSVCRT_GETWCH_METHODDEF
670 #define MSVCRT_GETWCH_METHODDEF
671 #endif /* !defined(MSVCRT_GETWCH_METHODDEF) */
672
673 #ifndef MSVCRT_GETWCHE_METHODDEF
674 #define MSVCRT_GETWCHE_METHODDEF
675 #endif /* !defined(MSVCRT_GETWCHE_METHODDEF) */
676
677 #ifndef MSVCRT_PUTWCH_METHODDEF
678 #define MSVCRT_PUTWCH_METHODDEF
679 #endif /* !defined(MSVCRT_PUTWCH_METHODDEF) */
680
681 #ifndef MSVCRT_UNGETWCH_METHODDEF
682 #define MSVCRT_UNGETWCH_METHODDEF
683 #endif /* !defined(MSVCRT_UNGETWCH_METHODDEF) */
684
685 #ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF
686 #define MSVCRT_CRTSETREPORTFILE_METHODDEF
687 #endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */
688
689 #ifndef MSVCRT_CRTSETREPORTMODE_METHODDEF
690 #define MSVCRT_CRTSETREPORTMODE_METHODDEF
691 #endif /* !defined(MSVCRT_CRTSETREPORTMODE_METHODDEF) */
692
693 #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
694 #define MSVCRT_SET_ERROR_MODE_METHODDEF
695 #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
696
697 #ifndef MSVCRT_GETERRORMODE_METHODDEF
698 #define MSVCRT_GETERRORMODE_METHODDEF
699 #endif /* !defined(MSVCRT_GETERRORMODE_METHODDEF) */
700 /*[clinic end generated code: output=de9687b46212c2ed input=a9049054013a1b77]*/
701