Debian Codegraph @

PC/clinic/msvcrtmodule.c.h

raw
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 *
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 *
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 *
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 *
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 *
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 *
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 *
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 *
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 *
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 *
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 *
353 msvcrt_putch(PyObject *module, PyObject *arg)
354 {
355 PyObject *return_value = NULL;
356 char char_value;
357
358 if (PyBytes_Check(arg)) {
359 if (PyBytes_GET_SIZE(arg) != 1) {
360 PyErr_Format(PyExc_TypeError,
361 "putch(): argument must be a byte string of length 1, "
362 "not a bytes object of length %zd",
363 PyBytes_GET_SIZE(arg));
364 goto exit;
365 }
366 char_value = PyBytes_AS_STRING(arg)[0];
367 }
368 else if (PyByteArray_Check(arg)) {
369 if (PyByteArray_GET_SIZE(arg) != 1) {
370 PyErr_Format(PyExc_TypeError,
371 "putch(): argument must be a byte string of length 1, "
372 "not a bytearray object of length %zd",
373 PyByteArray_GET_SIZE(arg));
374 goto exit;
375 }
376 char_value = PyByteArray_AS_STRING(arg)[0];
377 }
378 else {
379 _PyArg_BadArgument("putch", "argument", "a byte string of length 1", arg);
380 goto exit;
381 }
382 return_value = msvcrt_putch_impl(module, char_value);
383
384 exit:
385 return return_value;
386 }
387
388 #if defined(MS_WINDOWS_DESKTOP)
389
390 PyDoc_STRVAR(msvcrt_putwch__doc__,
391 "putwch($module, unicode_char, /)\n"
392 "--\n"
393 "\n"
394 "Wide char variant of putch(), accepting a Unicode value.");
395
396 #define MSVCRT_PUTWCH_METHODDEF \
397 {"putwch", (PyCFunction)msvcrt_putwch, METH_O, msvcrt_putwch__doc__},
398
399 static PyObject *
400 msvcrt_putwch_impl(PyObject *module, int unicode_char);
401
402 static PyObject *
403 msvcrt_putwch(PyObject *module, PyObject *arg)
404 {
405 PyObject *return_value = NULL;
406 int unicode_char;
407
408 if (!PyUnicode_Check(arg)) {
409 _PyArg_BadArgument("putwch", "argument", "a unicode character", arg);
410 goto exit;
411 }
412 if (PyUnicode_GET_LENGTH(arg) != 1) {
413 PyErr_Format(PyExc_TypeError,
414 "putwch(): argument must be a unicode character, "
415 "not a string of length %zd",
416 PyUnicode_GET_LENGTH(arg));
417 goto exit;
418 }
419 unicode_char = PyUnicode_READ_CHAR(arg, 0);
420 return_value = msvcrt_putwch_impl(module, unicode_char);
421
422 exit:
423 return return_value;
424 }
425
426 #endif /* defined(MS_WINDOWS_DESKTOP) */
427
428 PyDoc_STRVAR(msvcrt_ungetch__doc__,
429 "ungetch($module, char, /)\n"
430 "--\n"
431 "\n"
432 "Opposite of getch.\n"
433 "\n"
434 "Cause the byte string char to be \"pushed back\" into the\n"
435 "console buffer; it will be the next character read by\n"
436 "getch() or getche().");
437
438 #define MSVCRT_UNGETCH_METHODDEF \
439 {"ungetch", (PyCFunction)msvcrt_ungetch, METH_O, msvcrt_ungetch__doc__},
440
441 static PyObject *
442 msvcrt_ungetch_impl(PyObject *module, char char_value);
443
444 static PyObject *
445 msvcrt_ungetch(PyObject *module, PyObject *arg)
446 {
447 PyObject *return_value = NULL;
448 char char_value;
449
450 if (PyBytes_Check(arg)) {
451 if (PyBytes_GET_SIZE(arg) != 1) {
452 PyErr_Format(PyExc_TypeError,
453 "ungetch(): argument must be a byte string of length 1, "
454 "not a bytes object of length %zd",
455 PyBytes_GET_SIZE(arg));
456 goto exit;
457 }
458 char_value = PyBytes_AS_STRING(arg)[0];
459 }
460 else if (PyByteArray_Check(arg)) {
461 if (PyByteArray_GET_SIZE(arg) != 1) {
462 PyErr_Format(PyExc_TypeError,
463 "ungetch(): argument must be a byte string of length 1, "
464 "not a bytearray object of length %zd",
465 PyByteArray_GET_SIZE(arg));
466 goto exit;
467 }
468 char_value = PyByteArray_AS_STRING(arg)[0];
469 }
470 else {
471 _PyArg_BadArgument("ungetch", "argument", "a byte string of length 1", arg);
472 goto exit;
473 }
474 return_value = msvcrt_ungetch_impl(module, char_value);
475
476 exit:
477 return return_value;
478 }
479
480 #if defined(MS_WINDOWS_DESKTOP)
481
482 PyDoc_STRVAR(msvcrt_ungetwch__doc__,
483 "ungetwch($module, unicode_char, /)\n"
484 "--\n"
485 "\n"
486 "Wide char variant of ungetch(), accepting a Unicode value.");
487
488 #define MSVCRT_UNGETWCH_METHODDEF \
489 {"ungetwch", (PyCFunction)msvcrt_ungetwch, METH_O, msvcrt_ungetwch__doc__},
490
491 static PyObject *
492 msvcrt_ungetwch_impl(PyObject *module, int unicode_char);
493
494 static PyObject *
495 msvcrt_ungetwch(PyObject *module, PyObject *arg)
496 {
497 PyObject *return_value = NULL;
498 int unicode_char;
499
500 if (!PyUnicode_Check(arg)) {
501 _PyArg_BadArgument("ungetwch", "argument", "a unicode character", arg);
502 goto exit;
503 }
504 if (PyUnicode_GET_LENGTH(arg) != 1) {
505 PyErr_Format(PyExc_TypeError,
506 "ungetwch(): argument must be a unicode character, "
507 "not a string of length %zd",
508 PyUnicode_GET_LENGTH(arg));
509 goto exit;
510 }
511 unicode_char = PyUnicode_READ_CHAR(arg, 0);
512 return_value = msvcrt_ungetwch_impl(module, unicode_char);
513
514 exit:
515 return return_value;
516 }
517
518 #endif /* defined(MS_WINDOWS_DESKTOP) */
519
520 #if defined(_DEBUG)
521
522 PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__,
523 "CrtSetReportFile($module, type, file, /)\n"
524 "--\n"
525 "\n"
526 "Wrapper around _CrtSetReportFile.\n"
527 "\n"
528 "Only available on Debug builds.");
529
530 #define MSVCRT_CRTSETREPORTFILE_METHODDEF \
531 {"CrtSetReportFile", _PyCFunction_CAST(msvcrt_CrtSetReportFile), METH_FASTCALL, msvcrt_CrtSetReportFile__doc__},
532
533 static void *
534 msvcrt_CrtSetReportFile_impl(PyObject *module, int type, void *file);
535
536 static PyObject *
537 msvcrt_CrtSetReportFile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
538 {
539 PyObject *return_value = NULL;
540 int type;
541 void *file;
542 void *_return_value;
543
544 if (!_PyArg_CheckPositional("CrtSetReportFile", nargs, 2, 2)) {
545 goto exit;
546 }
547 type = PyLong_AsInt(args[0]);
548 if (type == -1 && PyErr_Occurred()) {
549 goto exit;
550 }
551 file = PyLong_AsVoidPtr(args[1]);
552 if (!file && PyErr_Occurred()) {
553 goto exit;
554 }
555 _return_value = msvcrt_CrtSetReportFile_impl(module, type, file);
556 if ((_return_value == NULL || _return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) {
557 goto exit;
558 }
559 return_value = PyLong_FromVoidPtr(_return_value);
560
561 exit:
562 return return_value;
563 }
564
565 #endif /* defined(_DEBUG) */
566
567 #if defined(_DEBUG)
568
569 PyDoc_STRVAR(msvcrt_CrtSetReportMode__doc__,
570 "CrtSetReportMode($module, type, mode, /)\n"
571 "--\n"
572 "\n"
573 "Wrapper around _CrtSetReportMode.\n"
574 "\n"
575 "Only available on Debug builds.");
576
577 #define MSVCRT_CRTSETREPORTMODE_METHODDEF \
578 {"CrtSetReportMode", _PyCFunction_CAST(msvcrt_CrtSetReportMode), METH_FASTCALL, msvcrt_CrtSetReportMode__doc__},
579
580 static long
581 msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode);
582
583 static PyObject *
584 msvcrt_CrtSetReportMode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
585 {
586 PyObject *return_value = NULL;
587 int type;
588 int mode;
589 long _return_value;
590
591 if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) {
592 goto exit;
593 }
594 type = PyLong_AsInt(args[0]);
595 if (type == -1 && PyErr_Occurred()) {
596 goto exit;
597 }
598 mode = PyLong_AsInt(args[1]);
599 if (mode == -1 && PyErr_Occurred()) {
600 goto exit;
601 }
602 _return_value = msvcrt_CrtSetReportMode_impl(module, type, mode);
603 if ((_return_value == -1) && PyErr_Occurred()) {
604 goto exit;
605 }
606 return_value = PyLong_FromLong(_return_value);
607
608 exit:
609 return return_value;
610 }
611
612 #endif /* defined(_DEBUG) */
613
614 #if defined(_DEBUG)
615
616 PyDoc_STRVAR(msvcrt_set_error_mode__doc__,
617 "set_error_mode($module, mode, /)\n"
618 "--\n"
619 "\n"
620 "Wrapper around _set_error_mode.\n"
621 "\n"
622 "Only available on Debug builds.");
623
624 #define MSVCRT_SET_ERROR_MODE_METHODDEF \
625 {"set_error_mode", (PyCFunction)msvcrt_set_error_mode, METH_O, msvcrt_set_error_mode__doc__},
626
627 static long
628 msvcrt_set_error_mode_impl(PyObject *module, int mode);
629
630 static PyObject *
631 msvcrt_set_error_mode(PyObject *module, PyObject *arg)
632 {
633 PyObject *return_value = NULL;
634 int mode;
635 long _return_value;
636
637 mode = PyLong_AsInt(arg);
638 if (mode == -1 && PyErr_Occurred()) {
639 goto exit;
640 }
641 _return_value = msvcrt_set_error_mode_impl(module, mode);
642 if ((_return_value == -1) && PyErr_Occurred()) {
643 goto exit;
644 }
645 return_value = PyLong_FromLong(_return_value);
646
647 exit:
648 return return_value;
649 }
650
651 #endif /* defined(_DEBUG) */
652
653 #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM))
654
655 PyDoc_STRVAR(msvcrt_GetErrorMode__doc__,
656 "GetErrorMode($module, /)\n"
657 "--\n"
658 "\n"
659 "Wrapper around GetErrorMode.");
660
661 #define MSVCRT_GETERRORMODE_METHODDEF \
662 {"GetErrorMode", (PyCFunction)msvcrt_GetErrorMode, METH_NOARGS, msvcrt_GetErrorMode__doc__},
663
664 static PyObject *
665 msvcrt_GetErrorMode_impl(PyObject *module);
666
667 static PyObject *
668 msvcrt_GetErrorMode(PyObject *module, PyObject *Py_UNUSED(ignored))
669 {
670 return msvcrt_GetErrorMode_impl(module);
671 }
672
673 #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)) */
674
675 PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
676 "SetErrorMode($module, mode, /)\n"
677 "--\n"
678 "\n"
679 "Wrapper around SetErrorMode.");
680
681 #define MSVCRT_SETERRORMODE_METHODDEF \
682 {"SetErrorMode", (PyCFunction)msvcrt_SetErrorMode, METH_O, msvcrt_SetErrorMode__doc__},
683
684 static PyObject *
685 msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode);
686
687 static PyObject *
688 msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
689 {
690 PyObject *return_value = NULL;
691 unsigned int mode;
692
693 mode = (unsigned int)PyLong_AsUnsignedLongMask(arg);
694 if (mode == (unsigned int)-1 && PyErr_Occurred()) {
695 goto exit;
696 }
697 return_value = msvcrt_SetErrorMode_impl(module, mode);
698
699 exit:
700 return return_value;
701 }
702
703 #ifndef MSVCRT_GETWCH_METHODDEF
704 #define MSVCRT_GETWCH_METHODDEF
705 #endif /* !defined(MSVCRT_GETWCH_METHODDEF) */
706
707 #ifndef MSVCRT_GETWCHE_METHODDEF
708 #define MSVCRT_GETWCHE_METHODDEF
709 #endif /* !defined(MSVCRT_GETWCHE_METHODDEF) */
710
711 #ifndef MSVCRT_PUTWCH_METHODDEF
712 #define MSVCRT_PUTWCH_METHODDEF
713 #endif /* !defined(MSVCRT_PUTWCH_METHODDEF) */
714
715 #ifndef MSVCRT_UNGETWCH_METHODDEF
716 #define MSVCRT_UNGETWCH_METHODDEF
717 #endif /* !defined(MSVCRT_UNGETWCH_METHODDEF) */
718
719 #ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF
720 #define MSVCRT_CRTSETREPORTFILE_METHODDEF
721 #endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */
722
723 #ifndef MSVCRT_CRTSETREPORTMODE_METHODDEF
724 #define MSVCRT_CRTSETREPORTMODE_METHODDEF
725 #endif /* !defined(MSVCRT_CRTSETREPORTMODE_METHODDEF) */
726
727 #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
728 #define MSVCRT_SET_ERROR_MODE_METHODDEF
729 #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
730
731 #ifndef MSVCRT_GETERRORMODE_METHODDEF
732 #define MSVCRT_GETERRORMODE_METHODDEF
733 #endif /* !defined(MSVCRT_GETERRORMODE_METHODDEF) */
734 /*[clinic end generated code: output=692c6f52bb9193ce input=a9049054013a1b77]*/