1997-08-06 21:11:34 -03:00
|
|
|
/*********************************************************
|
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
msvcrtmodule.c
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
A Python interface to the Microsoft Visual C Runtime
|
|
|
|
Library, providing access to those non-portable, but
|
|
|
|
still useful routines.
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
Only ever compiled with an MS compiler, so no attempt
|
|
|
|
has been made to avoid MS language extensions, etc...
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
This may only work on NT or 95...
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
Author: Mark Hammond and Guido van Rossum.
|
|
|
|
Maintenance: Guido van Rossum.
|
1997-08-13 16:57:53 -03:00
|
|
|
|
1997-08-06 21:11:34 -03:00
|
|
|
***********************************************************/
|
1997-08-13 16:57:53 -03:00
|
|
|
|
1997-08-06 21:11:34 -03:00
|
|
|
#include "Python.h"
|
2021-10-13 10:03:35 -03:00
|
|
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
1997-08-06 21:11:34 -03:00
|
|
|
#include "malloc.h"
|
2000-12-11 21:58:56 -04:00
|
|
|
#include <io.h>
|
|
|
|
#include <conio.h>
|
|
|
|
#include <sys/locking.h>
|
2007-08-31 04:58:36 -03:00
|
|
|
#include <crtdbg.h>
|
|
|
|
#include <windows.h>
|
1997-08-13 16:57:53 -03:00
|
|
|
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
#ifdef _MSC_VER
|
2010-02-18 12:27:43 -04:00
|
|
|
#if _MSC_VER >= 1500 && _MSC_VER < 1600
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
#include <crtassem.h>
|
2012-05-13 13:19:23 -03:00
|
|
|
#elif _MSC_VER >= 1600
|
|
|
|
#include <crtversion.h>
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[python input]
|
2017-07-26 19:17:57 -03:00
|
|
|
class HANDLE_converter(CConverter):
|
|
|
|
type = 'void *'
|
2017-07-27 00:15:18 -03:00
|
|
|
format_unit = '"_Py_PARSE_UINTPTR"'
|
2015-05-13 03:22:32 -03:00
|
|
|
|
2023-09-03 11:28:14 -03:00
|
|
|
def parse_arg(self, argname, displayname, *, limited_capi):
|
|
|
|
return self.format_code("""
|
2022-07-04 10:09:34 -03:00
|
|
|
{paramname} = PyLong_AsVoidPtr({argname});
|
|
|
|
if (!{paramname} && PyErr_Occurred()) {{{{
|
|
|
|
goto exit;
|
|
|
|
}}}}
|
2023-09-03 11:28:14 -03:00
|
|
|
""",
|
|
|
|
argname=argname)
|
2022-07-04 10:09:34 -03:00
|
|
|
|
2017-07-26 19:17:57 -03:00
|
|
|
class HANDLE_return_converter(CReturnConverter):
|
|
|
|
type = 'void *'
|
|
|
|
|
|
|
|
def render(self, function, data):
|
|
|
|
self.declare(data)
|
|
|
|
self.err_occurred_if(
|
|
|
|
"_return_value == NULL || _return_value == INVALID_HANDLE_VALUE",
|
|
|
|
data)
|
|
|
|
data.return_conversion.append(
|
|
|
|
'return_value = PyLong_FromVoidPtr(_return_value);\n')
|
2015-05-13 03:22:32 -03:00
|
|
|
|
|
|
|
class byte_char_return_converter(CReturnConverter):
|
|
|
|
type = 'int'
|
|
|
|
|
|
|
|
def render(self, function, data):
|
|
|
|
data.declarations.append('char s[1];')
|
|
|
|
data.return_value = 's[0]'
|
|
|
|
data.return_conversion.append(
|
|
|
|
'return_value = PyBytes_FromStringAndSize(s, 1);\n')
|
|
|
|
|
|
|
|
class wchar_t_return_converter(CReturnConverter):
|
|
|
|
type = 'wchar_t'
|
|
|
|
|
|
|
|
def render(self, function, data):
|
|
|
|
self.declare(data)
|
|
|
|
data.return_conversion.append(
|
|
|
|
'return_value = PyUnicode_FromOrdinal(_return_value);\n')
|
|
|
|
[python start generated code]*/
|
2023-09-03 11:28:14 -03:00
|
|
|
/*[python end generated code: output=da39a3ee5e6b4b0d input=ff031be44ab3250d]*/
|
2015-05-13 03:22:32 -03:00
|
|
|
|
|
|
|
/*[clinic input]
|
|
|
|
module msvcrt
|
|
|
|
[clinic start generated code]*/
|
|
|
|
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f31a87a783d036cd]*/
|
|
|
|
|
|
|
|
#include "clinic/msvcrtmodule.c.h"
|
|
|
|
|
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.heapmin
|
|
|
|
|
|
|
|
Minimize the malloc() heap.
|
|
|
|
|
|
|
|
Force the malloc() heap to clean itself up and return unused blocks
|
|
|
|
to the operating system. On failure, this raises OSError.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
2000-12-11 21:58:56 -04:00
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_heapmin_impl(PyObject *module)
|
|
|
|
/*[clinic end generated code: output=1ba00f344782dc19 input=82e1771d21bde2d8]*/
|
1997-08-06 21:11:34 -03:00
|
|
|
{
|
2010-05-09 12:52:27 -03:00
|
|
|
if (_heapmin() != 0)
|
2017-04-16 04:46:38 -03:00
|
|
|
return PyErr_SetFromErrno(PyExc_OSError);
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Py_RETURN_NONE;
|
1997-08-06 21:11:34 -03:00
|
|
|
}
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.locking
|
|
|
|
|
|
|
|
fd: int
|
|
|
|
mode: int
|
|
|
|
nbytes: long
|
|
|
|
/
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Lock part of a file based on file descriptor fd from the C runtime.
|
|
|
|
|
2017-04-16 04:46:38 -03:00
|
|
|
Raises OSError on failure. The locked region of the file extends from
|
2015-05-13 03:22:32 -03:00
|
|
|
the current file position for nbytes bytes, and may continue beyond
|
|
|
|
the end of the file. mode must be one of the LK_* constants listed
|
|
|
|
below. Multiple regions in a file may be locked at the same time, but
|
|
|
|
may not overlap. Adjacent regions are not merged; they must be unlocked
|
|
|
|
individually.
|
|
|
|
[clinic start generated code]*/
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2000-12-11 21:58:56 -04:00
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes)
|
2017-04-16 04:46:38 -03:00
|
|
|
/*[clinic end generated code: output=a4a90deca9785a03 input=e97bd15fc4a04fef]*/
|
1997-08-06 21:11:34 -03:00
|
|
|
{
|
2010-05-09 12:52:27 -03:00
|
|
|
int err;
|
|
|
|
|
2020-02-13 03:47:42 -04:00
|
|
|
if (PySys_Audit("msvcrt.locking", "iil", fd, mode, nbytes) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
err = _locking(fd, mode, nbytes);
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_END_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
Py_END_ALLOW_THREADS
|
|
|
|
if (err != 0)
|
2017-04-16 04:46:38 -03:00
|
|
|
return PyErr_SetFromErrno(PyExc_OSError);
|
2010-05-09 12:52:27 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Py_RETURN_NONE;
|
1997-08-06 21:11:34 -03:00
|
|
|
}
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.setmode -> long
|
|
|
|
|
|
|
|
fd: int
|
|
|
|
mode as flags: int
|
|
|
|
/
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Set the line-end translation mode for the file descriptor fd.
|
|
|
|
|
|
|
|
To set it to text mode, flags should be os.O_TEXT; for binary, it
|
|
|
|
should be os.O_BINARY.
|
|
|
|
|
|
|
|
Return value is the previous mode.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static long
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_setmode_impl(PyObject *module, int fd, int flags)
|
|
|
|
/*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/
|
2015-05-13 03:22:32 -03:00
|
|
|
{
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
flags = _setmode(fd, flags);
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_END_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
if (flags == -1)
|
2017-04-16 04:46:38 -03:00
|
|
|
PyErr_SetFromErrno(PyExc_OSError);
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
return flags;
|
1997-08-13 16:57:53 -03:00
|
|
|
}
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.open_osfhandle -> long
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2017-07-26 19:17:57 -03:00
|
|
|
handle: HANDLE
|
2015-05-13 03:22:32 -03:00
|
|
|
flags: int
|
|
|
|
/
|
|
|
|
|
|
|
|
Create a C runtime file descriptor from the file handle handle.
|
|
|
|
|
|
|
|
The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,
|
|
|
|
and os.O_TEXT. The returned file descriptor may be used as a parameter
|
|
|
|
to os.fdopen() to create a file object.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static long
|
2017-07-26 19:17:57 -03:00
|
|
|
msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags)
|
|
|
|
/*[clinic end generated code: output=b2fb97c4b515e4e6 input=d5db190a307cf4bb]*/
|
1997-08-06 21:11:34 -03:00
|
|
|
{
|
2020-02-13 03:47:42 -04:00
|
|
|
if (PySys_Audit("msvcrt.open_osfhandle", "Ki", handle, flags) < 0) {
|
2020-02-20 18:24:44 -04:00
|
|
|
return -1;
|
2020-02-13 03:47:42 -04:00
|
|
|
}
|
|
|
|
|
2021-04-23 19:00:27 -03:00
|
|
|
return _Py_open_osfhandle(handle, flags);
|
1997-08-13 16:57:53 -03:00
|
|
|
}
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
2017-07-26 19:17:57 -03:00
|
|
|
msvcrt.get_osfhandle -> HANDLE
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
fd: int
|
|
|
|
/
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Return the file handle for the file descriptor fd.
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2017-04-16 04:46:38 -03:00
|
|
|
Raises OSError if fd is not recognized.
|
2015-05-13 03:22:32 -03:00
|
|
|
[clinic start generated code]*/
|
|
|
|
|
2017-07-26 19:17:57 -03:00
|
|
|
static void *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
|
2017-07-26 19:17:57 -03:00
|
|
|
/*[clinic end generated code: output=aca01dfe24637374 input=5fcfde9b17136aa2]*/
|
2015-05-13 03:22:32 -03:00
|
|
|
{
|
2020-02-13 03:47:42 -04:00
|
|
|
if (PySys_Audit("msvcrt.get_osfhandle", "(i)", fd) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2021-04-23 19:00:27 -03:00
|
|
|
return _Py_get_osfhandle(fd);
|
1997-08-13 16:57:53 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Console I/O */
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.kbhit -> long
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2023-09-12 11:44:48 -03:00
|
|
|
Returns a nonzero value if a keypress is waiting to be read. Otherwise, return 0.
|
2015-05-13 03:22:32 -03:00
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static long
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_kbhit_impl(PyObject *module)
|
2023-09-12 11:44:48 -03:00
|
|
|
/*[clinic end generated code: output=940dfce6587c1890 input=d0f4cb3289ff51e2]*/
|
1997-08-13 16:57:53 -03:00
|
|
|
{
|
2015-05-13 03:22:32 -03:00
|
|
|
return _kbhit();
|
|
|
|
}
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.getch -> byte_char
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Read a keypress and return the resulting character as a byte string.
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Nothing is echoed to the console. This call will block if a keypress is
|
|
|
|
not already available, but will not wait for Enter to be pressed. If the
|
|
|
|
pressed key was a special function key, this will return '\000' or
|
|
|
|
'\xe0'; the next call will return the keycode. The Control-C keypress
|
|
|
|
cannot be read with this function.
|
|
|
|
[clinic start generated code]*/
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
static int
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_getch_impl(PyObject *module)
|
|
|
|
/*[clinic end generated code: output=a4e51f0565064a7d input=37a40cf0ed0d1153]*/
|
1997-08-13 16:57:53 -03:00
|
|
|
{
|
2010-05-09 12:52:27 -03:00
|
|
|
int ch;
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getch();
|
|
|
|
Py_END_ALLOW_THREADS
|
2015-05-13 03:22:32 -03:00
|
|
|
return ch;
|
1997-08-13 16:57:53 -03:00
|
|
|
}
|
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#ifdef MS_WINDOWS_DESKTOP
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.getwch -> wchar_t
|
|
|
|
|
|
|
|
Wide char variant of getch(), returning a Unicode value.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static wchar_t
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_getwch_impl(PyObject *module)
|
|
|
|
/*[clinic end generated code: output=be9937494e22f007 input=27b3dec8ad823d7c]*/
|
2007-12-10 12:18:49 -04:00
|
|
|
{
|
2011-11-21 21:27:30 -04:00
|
|
|
wchar_t ch;
|
2007-12-10 12:18:49 -04:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getwch();
|
|
|
|
Py_END_ALLOW_THREADS
|
2015-05-13 03:22:32 -03:00
|
|
|
return ch;
|
2007-12-10 12:18:49 -04:00
|
|
|
}
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#endif /* MS_WINDOWS_DESKTOP */
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.getche -> byte_char
|
2007-12-10 12:18:49 -04:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Similar to getch(), but the keypress will be echoed if possible.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static int
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_getche_impl(PyObject *module)
|
|
|
|
/*[clinic end generated code: output=d8f7db4fd2990401 input=43311ade9ed4a9c0]*/
|
1997-08-13 16:57:53 -03:00
|
|
|
{
|
2010-05-09 12:52:27 -03:00
|
|
|
int ch;
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getche();
|
|
|
|
Py_END_ALLOW_THREADS
|
2015-05-13 03:22:32 -03:00
|
|
|
return ch;
|
1997-08-13 16:57:53 -03:00
|
|
|
}
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#ifdef MS_WINDOWS_DESKTOP
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.getwche -> wchar_t
|
|
|
|
|
|
|
|
Wide char variant of getche(), returning a Unicode value.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static wchar_t
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_getwche_impl(PyObject *module)
|
|
|
|
/*[clinic end generated code: output=d0dae5ba3829d596 input=49337d59d1a591f8]*/
|
2007-12-10 12:18:49 -04:00
|
|
|
{
|
2011-11-21 21:27:30 -04:00
|
|
|
wchar_t ch;
|
2007-12-10 12:18:49 -04:00
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getwche();
|
|
|
|
Py_END_ALLOW_THREADS
|
2015-05-13 03:22:32 -03:00
|
|
|
return ch;
|
2007-12-10 12:18:49 -04:00
|
|
|
}
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#endif /* MS_WINDOWS_DESKTOP */
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.putch
|
|
|
|
|
|
|
|
char: char
|
|
|
|
/
|
|
|
|
|
|
|
|
Print the byte string char to the console without buffering.
|
|
|
|
[clinic start generated code]*/
|
2007-12-10 12:18:49 -04:00
|
|
|
|
2000-12-11 21:58:56 -04:00
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_putch_impl(PyObject *module, char char_value)
|
|
|
|
/*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/
|
1997-08-13 16:57:53 -03:00
|
|
|
{
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2015-05-13 03:22:32 -03:00
|
|
|
_putch(char_value);
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_END_SUPPRESS_IPH
|
2015-05-13 03:22:32 -03:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#ifdef MS_WINDOWS_DESKTOP
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.putwch
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 12:58:35 -03:00
|
|
|
unicode_char: int(accept={str})
|
2015-05-13 03:22:32 -03:00
|
|
|
/
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Wide char variant of putch(), accepting a Unicode value.
|
|
|
|
[clinic start generated code]*/
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2007-12-10 12:18:49 -04:00
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_putwch_impl(PyObject *module, int unicode_char)
|
|
|
|
/*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/
|
2007-12-10 12:18:49 -04:00
|
|
|
{
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2015-05-13 03:22:32 -03:00
|
|
|
_putwch(unicode_char);
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_END_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
Py_RETURN_NONE;
|
2007-12-10 12:18:49 -04:00
|
|
|
|
|
|
|
}
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#endif /* MS_WINDOWS_DESKTOP */
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.ungetch
|
2007-12-10 12:18:49 -04:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
char: char
|
|
|
|
/
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Opposite of getch.
|
1997-08-13 16:57:53 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Cause the byte string char to be "pushed back" into the
|
|
|
|
console buffer; it will be the next character read by
|
|
|
|
getch() or getche().
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_ungetch_impl(PyObject *module, char char_value)
|
|
|
|
/*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/
|
2015-05-13 03:22:32 -03:00
|
|
|
{
|
2017-02-04 19:05:13 -04:00
|
|
|
int res;
|
2017-09-14 03:38:36 -03:00
|
|
|
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
|
|
|
res = _ungetch(char_value);
|
|
|
|
_Py_END_SUPPRESS_IPH
|
|
|
|
|
|
|
|
if (res == EOF)
|
2017-04-16 04:46:38 -03:00
|
|
|
return PyErr_SetFromErrno(PyExc_OSError);
|
2015-05-13 03:22:32 -03:00
|
|
|
Py_RETURN_NONE;
|
1997-08-13 16:57:53 -03:00
|
|
|
}
|
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#ifdef MS_WINDOWS_DESKTOP
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.ungetwch
|
2007-12-10 12:18:49 -04:00
|
|
|
|
2015-05-13 12:58:35 -03:00
|
|
|
unicode_char: int(accept={str})
|
2015-05-13 03:22:32 -03:00
|
|
|
/
|
|
|
|
|
|
|
|
Wide char variant of ungetch(), accepting a Unicode value.
|
|
|
|
[clinic start generated code]*/
|
2007-12-10 12:18:49 -04:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_ungetwch_impl(PyObject *module, int unicode_char)
|
|
|
|
/*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/
|
2015-05-13 03:22:32 -03:00
|
|
|
{
|
2017-02-04 19:05:13 -04:00
|
|
|
int res;
|
|
|
|
|
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
|
|
|
res = _ungetwch(unicode_char);
|
|
|
|
_Py_END_SUPPRESS_IPH
|
|
|
|
|
|
|
|
if (res == WEOF)
|
2017-04-16 04:46:38 -03:00
|
|
|
return PyErr_SetFromErrno(PyExc_OSError);
|
2015-05-13 03:22:32 -03:00
|
|
|
Py_RETURN_NONE;
|
2007-12-10 12:18:49 -04:00
|
|
|
}
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#endif /* MS_WINDOWS_DESKTOP */
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
#ifdef _DEBUG
|
|
|
|
/*[clinic input]
|
2017-07-26 19:17:57 -03:00
|
|
|
msvcrt.CrtSetReportFile -> HANDLE
|
1997-08-06 21:11:34 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
type: int
|
2017-07-26 19:17:57 -03:00
|
|
|
file: HANDLE
|
2015-05-13 03:22:32 -03:00
|
|
|
/
|
|
|
|
|
|
|
|
Wrapper around _CrtSetReportFile.
|
|
|
|
|
|
|
|
Only available on Debug builds.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
2017-07-26 19:17:57 -03:00
|
|
|
static void *
|
|
|
|
msvcrt_CrtSetReportFile_impl(PyObject *module, int type, void *file)
|
|
|
|
/*[clinic end generated code: output=9393e8c77088bbe9 input=290809b5f19e65b9]*/
|
2000-12-11 21:58:56 -04:00
|
|
|
{
|
2017-07-26 19:17:57 -03:00
|
|
|
HANDLE res;
|
2017-02-04 19:05:13 -04:00
|
|
|
|
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2017-07-26 19:17:57 -03:00
|
|
|
res = _CrtSetReportFile(type, file);
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_END_SUPPRESS_IPH
|
|
|
|
|
|
|
|
return res;
|
2000-12-11 21:58:56 -04:00
|
|
|
}
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.CrtSetReportMode -> long
|
2007-08-31 04:58:36 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
type: int
|
|
|
|
mode: int
|
|
|
|
/
|
2010-05-09 12:52:27 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Wrapper around _CrtSetReportMode.
|
|
|
|
|
|
|
|
Only available on Debug builds.
|
|
|
|
[clinic start generated code]*/
|
2007-08-31 04:58:36 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
static long
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode)
|
|
|
|
/*[clinic end generated code: output=b2863761523de317 input=9319d29b4319426b]*/
|
2007-08-31 04:58:36 -03:00
|
|
|
{
|
2010-05-09 12:52:27 -03:00
|
|
|
int res;
|
|
|
|
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
res = _CrtSetReportMode(type, mode);
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_END_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
if (res == -1)
|
2017-04-16 04:46:38 -03:00
|
|
|
PyErr_SetFromErrno(PyExc_OSError);
|
2015-05-13 03:22:32 -03:00
|
|
|
return res;
|
2007-08-31 04:58:36 -03:00
|
|
|
}
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.set_error_mode -> long
|
2007-08-31 04:58:36 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
mode: int
|
|
|
|
/
|
|
|
|
|
|
|
|
Wrapper around _set_error_mode.
|
|
|
|
|
|
|
|
Only available on Debug builds.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static long
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_set_error_mode_impl(PyObject *module, int mode)
|
|
|
|
/*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/
|
2015-05-13 03:22:32 -03:00
|
|
|
{
|
2017-02-04 19:05:13 -04:00
|
|
|
long res;
|
|
|
|
|
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
|
|
|
res = _set_error_mode(mode);
|
|
|
|
_Py_END_SUPPRESS_IPH
|
|
|
|
|
|
|
|
return res;
|
2007-08-31 04:58:36 -03:00
|
|
|
}
|
2015-05-13 03:22:32 -03:00
|
|
|
#endif /* _DEBUG */
|
2007-08-31 04:58:36 -03:00
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)
|
|
|
|
|
2020-06-10 13:49:23 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.GetErrorMode
|
|
|
|
|
|
|
|
Wrapper around GetErrorMode.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
msvcrt_GetErrorMode_impl(PyObject *module)
|
|
|
|
/*[clinic end generated code: output=3103fc6145913591 input=5a7fb083b6dd71fd]*/
|
|
|
|
{
|
|
|
|
unsigned int res;
|
|
|
|
|
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
|
|
|
res = GetErrorMode();
|
|
|
|
_Py_END_SUPPRESS_IPH
|
|
|
|
|
|
|
|
return PyLong_FromUnsignedLong(res);
|
|
|
|
}
|
|
|
|
|
2023-03-09 17:09:12 -04:00
|
|
|
#endif /* MS_WINDOWS_APP || MS_WINDOWS_SYSTEM */
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
msvcrt.SetErrorMode
|
|
|
|
|
|
|
|
mode: unsigned_int(bitwise=True)
|
|
|
|
/
|
2007-08-31 04:58:36 -03:00
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
Wrapper around SetErrorMode.
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode)
|
|
|
|
/*[clinic end generated code: output=01d529293f00da8f input=d8b167258d32d907]*/
|
2007-08-31 04:58:36 -03:00
|
|
|
{
|
2015-05-13 03:22:32 -03:00
|
|
|
unsigned int res;
|
2007-08-31 04:58:36 -03:00
|
|
|
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2010-05-09 12:52:27 -03:00
|
|
|
res = SetErrorMode(mode);
|
2017-02-04 19:05:13 -04:00
|
|
|
_Py_END_SUPPRESS_IPH
|
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
return PyLong_FromUnsignedLong(res);
|
2007-08-31 04:58:36 -03:00
|
|
|
}
|
|
|
|
|
2015-05-13 03:22:32 -03:00
|
|
|
/*[clinic input]
|
|
|
|
[clinic start generated code]*/
|
|
|
|
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=da39a3ee5e6b4b0d]*/
|
2000-12-11 21:58:56 -04:00
|
|
|
|
1997-08-06 21:11:34 -03:00
|
|
|
/* List of functions exported by this module */
|
|
|
|
static struct PyMethodDef msvcrt_functions[] = {
|
2015-05-13 03:22:32 -03:00
|
|
|
MSVCRT_HEAPMIN_METHODDEF
|
|
|
|
MSVCRT_LOCKING_METHODDEF
|
|
|
|
MSVCRT_SETMODE_METHODDEF
|
|
|
|
MSVCRT_OPEN_OSFHANDLE_METHODDEF
|
|
|
|
MSVCRT_GET_OSFHANDLE_METHODDEF
|
|
|
|
MSVCRT_KBHIT_METHODDEF
|
|
|
|
MSVCRT_GETCH_METHODDEF
|
|
|
|
MSVCRT_GETCHE_METHODDEF
|
|
|
|
MSVCRT_PUTCH_METHODDEF
|
|
|
|
MSVCRT_UNGETCH_METHODDEF
|
2020-06-10 13:49:23 -03:00
|
|
|
MSVCRT_GETERRORMODE_METHODDEF
|
2015-05-13 03:22:32 -03:00
|
|
|
MSVCRT_SETERRORMODE_METHODDEF
|
|
|
|
MSVCRT_CRTSETREPORTFILE_METHODDEF
|
|
|
|
MSVCRT_CRTSETREPORTMODE_METHODDEF
|
|
|
|
MSVCRT_SET_ERROR_MODE_METHODDEF
|
|
|
|
MSVCRT_GETWCH_METHODDEF
|
|
|
|
MSVCRT_GETWCHE_METHODDEF
|
|
|
|
MSVCRT_PUTWCH_METHODDEF
|
|
|
|
MSVCRT_UNGETWCH_METHODDEF
|
2010-05-09 12:52:27 -03:00
|
|
|
{NULL, NULL}
|
1997-08-06 21:11:34 -03:00
|
|
|
};
|
|
|
|
|
2023-04-19 11:15:50 -03:00
|
|
|
static int
|
2023-07-18 17:59:53 -03:00
|
|
|
insertptr(PyObject *mod, const char *name, void *value)
|
2017-07-26 19:17:57 -03:00
|
|
|
{
|
2023-07-18 17:59:53 -03:00
|
|
|
return PyModule_Add(mod, name, PyLong_FromVoidPtr(value));
|
2017-07-26 19:17:57 -03:00
|
|
|
}
|
|
|
|
|
2023-04-19 11:15:50 -03:00
|
|
|
#define INSERTINT(MOD, NAME, VAL) do { \
|
|
|
|
if (PyModule_AddIntConstant(MOD, NAME, VAL) < 0) { \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define INSERTPTR(MOD, NAME, PTR) do { \
|
|
|
|
if (insertptr(MOD, NAME, PTR) < 0) { \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define INSERTSTR(MOD, NAME, CONST) do { \
|
|
|
|
if (PyModule_AddStringConstant(MOD, NAME, CONST) < 0) { \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2023-04-12 07:41:21 -03:00
|
|
|
static int
|
|
|
|
exec_module(PyObject* m)
|
1997-08-06 21:11:34 -03:00
|
|
|
{
|
2010-05-09 12:52:27 -03:00
|
|
|
/* constants for the locking() function's mode argument */
|
2023-04-19 11:15:50 -03:00
|
|
|
INSERTINT(m, "LK_LOCK", _LK_LOCK);
|
|
|
|
INSERTINT(m, "LK_NBLCK", _LK_NBLCK);
|
|
|
|
INSERTINT(m, "LK_NBRLCK", _LK_NBRLCK);
|
|
|
|
INSERTINT(m, "LK_RLCK", _LK_RLCK);
|
|
|
|
INSERTINT(m, "LK_UNLCK", _LK_UNLCK);
|
2023-03-09 17:09:12 -04:00
|
|
|
#ifdef MS_WINDOWS_DESKTOP
|
2023-04-19 11:15:50 -03:00
|
|
|
INSERTINT(m, "SEM_FAILCRITICALERRORS", SEM_FAILCRITICALERRORS);
|
|
|
|
INSERTINT(m, "SEM_NOALIGNMENTFAULTEXCEPT", SEM_NOALIGNMENTFAULTEXCEPT);
|
|
|
|
INSERTINT(m, "SEM_NOGPFAULTERRORBOX", SEM_NOGPFAULTERRORBOX);
|
|
|
|
INSERTINT(m, "SEM_NOOPENFILEERRORBOX", SEM_NOOPENFILEERRORBOX);
|
2023-03-09 17:09:12 -04:00
|
|
|
#endif
|
2007-08-31 04:58:36 -03:00
|
|
|
#ifdef _DEBUG
|
2023-04-19 11:15:50 -03:00
|
|
|
INSERTINT(m, "CRT_WARN", _CRT_WARN);
|
|
|
|
INSERTINT(m, "CRT_ERROR", _CRT_ERROR);
|
|
|
|
INSERTINT(m, "CRT_ASSERT", _CRT_ASSERT);
|
|
|
|
INSERTINT(m, "CRTDBG_MODE_DEBUG", _CRTDBG_MODE_DEBUG);
|
|
|
|
INSERTINT(m, "CRTDBG_MODE_FILE", _CRTDBG_MODE_FILE);
|
|
|
|
INSERTINT(m, "CRTDBG_MODE_WNDW", _CRTDBG_MODE_WNDW);
|
|
|
|
INSERTINT(m, "CRTDBG_REPORT_MODE", _CRTDBG_REPORT_MODE);
|
|
|
|
INSERTPTR(m, "CRTDBG_FILE_STDERR", _CRTDBG_FILE_STDERR);
|
|
|
|
INSERTPTR(m, "CRTDBG_FILE_STDOUT", _CRTDBG_FILE_STDOUT);
|
|
|
|
INSERTPTR(m, "CRTDBG_REPORT_FILE", _CRTDBG_REPORT_FILE);
|
2023-09-21 12:44:24 -03:00
|
|
|
INSERTINT(m, "OUT_TO_DEFAULT", _OUT_TO_DEFAULT);
|
|
|
|
INSERTINT(m, "OUT_TO_STDERR", _OUT_TO_STDERR);
|
|
|
|
INSERTINT(m, "OUT_TO_MSGBOX", _OUT_TO_MSGBOX);
|
|
|
|
INSERTINT(m, "REPORT_ERRMODE", _REPORT_ERRMODE);
|
2007-08-31 04:58:36 -03:00
|
|
|
#endif
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
|
2023-04-19 11:15:50 -03:00
|
|
|
#undef INSERTINT
|
|
|
|
#undef INSERTPTR
|
|
|
|
|
2010-05-09 12:52:27 -03:00
|
|
|
/* constants for the crt versions */
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
|
2023-04-19 11:15:50 -03:00
|
|
|
INSERTSTR(m, "VC_ASSEMBLY_PUBLICKEYTOKEN", _VC_ASSEMBLY_PUBLICKEYTOKEN);
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
#endif
|
|
|
|
#ifdef _CRT_ASSEMBLY_VERSION
|
2023-04-19 11:15:50 -03:00
|
|
|
INSERTSTR(m, "CRT_ASSEMBLY_VERSION", _CRT_ASSEMBLY_VERSION);
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
#endif
|
|
|
|
#ifdef __LIBRARIES_ASSEMBLY_NAME_PREFIX
|
2023-04-19 11:15:50 -03:00
|
|
|
INSERTSTR(m, "LIBRARIES_ASSEMBLY_NAME_PREFIX",
|
|
|
|
__LIBRARIES_ASSEMBLY_NAME_PREFIX);
|
Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line
raise a better error
........
r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines
#4392: fix parameter name.
........
r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines
#4399: fix typo.
........
r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines
replace reference to debugger-hooks
........
r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line
#4396 make the parser module correctly validate the with syntax
........
r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines
Fix typo.
........
r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines
#4404: make clear what "path" is.
........
r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line
fix typo in sqlite3 docs
........
r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines
issue4238: bsd support for cpu_count
........
r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line
Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line
SVN format 9 is the same it seems
........
r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines
Move definition int sval into branch of ifdef where it is used.
Otherwise, you get a warning about an undefined variable.
........
r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines
Reflow long lines.
........
r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines
Fix a small typo in docstring
........
r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line
StringIO.close() stops you from using the buffer, too
........
r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line
note the version that works
........
r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line
Issue #4365: Add crtassem.h constants to the msvcrt module.
........
r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line
w# requires Py_ssize_t
........
r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line
fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 18:46:23 -04:00
|
|
|
#endif
|
|
|
|
|
2023-04-19 11:15:50 -03:00
|
|
|
#undef INSERTSTR
|
|
|
|
|
2012-05-13 13:19:23 -03:00
|
|
|
/* constants for the 2010 crt versions */
|
|
|
|
#if defined(_VC_CRT_MAJOR_VERSION) && defined (_VC_CRT_MINOR_VERSION) && defined(_VC_CRT_BUILD_VERSION) && defined(_VC_CRT_RBUILD_VERSION)
|
2023-04-10 14:09:33 -03:00
|
|
|
PyObject *version = PyUnicode_FromFormat("%d.%d.%d.%d",
|
|
|
|
_VC_CRT_MAJOR_VERSION,
|
|
|
|
_VC_CRT_MINOR_VERSION,
|
|
|
|
_VC_CRT_BUILD_VERSION,
|
|
|
|
_VC_CRT_RBUILD_VERSION);
|
2023-07-18 17:59:53 -03:00
|
|
|
if (PyModule_Add(m, "CRT_ASSEMBLY_VERSION", version) < 0) {
|
2023-04-12 07:41:21 -03:00
|
|
|
return -1;
|
2023-04-10 14:09:33 -03:00
|
|
|
}
|
2012-05-13 13:19:23 -03:00
|
|
|
#endif
|
|
|
|
|
2023-04-12 07:41:21 -03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyModuleDef_Slot msvcrt_slots[] = {
|
|
|
|
{Py_mod_exec, exec_module},
|
2023-05-05 18:11:27 -03:00
|
|
|
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
|
2024-05-03 12:30:55 -03:00
|
|
|
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
|
2023-04-12 07:41:21 -03:00
|
|
|
{0, NULL}
|
|
|
|
};
|
2023-04-10 14:09:33 -03:00
|
|
|
|
2023-04-12 07:41:21 -03:00
|
|
|
static struct PyModuleDef msvcrtmodule = {
|
|
|
|
.m_base = PyModuleDef_HEAD_INIT,
|
|
|
|
.m_name = "msvcrt",
|
|
|
|
.m_methods = msvcrt_functions,
|
|
|
|
.m_slots = msvcrt_slots,
|
|
|
|
};
|
|
|
|
|
|
|
|
PyMODINIT_FUNC
|
|
|
|
PyInit_msvcrt(void)
|
|
|
|
{
|
|
|
|
return PyModuleDef_Init(&msvcrtmodule);
|
1997-08-06 21:11:34 -03:00
|
|
|
}
|