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