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