1997-08-07 08:11:34 +08:00
|
|
|
/*********************************************************
|
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
msvcrtmodule.c
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
A Python interface to the Microsoft Visual C Runtime
|
|
|
|
Library, providing access to those non-portable, but
|
|
|
|
still useful routines.
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
Only ever compiled with an MS compiler, so no attempt
|
|
|
|
has been made to avoid MS language extensions, etc...
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
This may only work on NT or 95...
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
Author: Mark Hammond and Guido van Rossum.
|
|
|
|
Maintenance: Guido van Rossum.
|
1997-08-14 03:57:53 +08:00
|
|
|
|
1997-08-07 08:11:34 +08:00
|
|
|
***********************************************************/
|
1997-08-14 03:57:53 +08:00
|
|
|
|
1997-08-07 08:11:34 +08:00
|
|
|
#include "Python.h"
|
|
|
|
#include "malloc.h"
|
2000-12-12 09:58:56 +08:00
|
|
|
#include <io.h>
|
|
|
|
#include <conio.h>
|
|
|
|
#include <sys/locking.h>
|
2007-08-31 15:58:36 +08:00
|
|
|
#include <crtdbg.h>
|
|
|
|
#include <windows.h>
|
1997-08-14 03:57:53 +08: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-12-01 06:46:23 +08:00
|
|
|
#ifdef _MSC_VER
|
2010-02-19 00:27:43 +08: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-12-01 06:46:23 +08:00
|
|
|
#include <crtassem.h>
|
2012-05-14 00:19:23 +08: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-12-01 06:46:23 +08:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
1997-08-14 03:57:53 +08:00
|
|
|
// Force the malloc heap to clean itself up, and free unused blocks
|
|
|
|
// back to the OS. (According to the docs, only works on NT.)
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_heapmin(PyObject *self, PyObject *args)
|
1997-08-07 08:11:34 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, ":heapmin"))
|
|
|
|
return NULL;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (_heapmin() != 0)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1997-08-07 08:11:34 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(heapmin_doc,
|
|
|
|
"heapmin() -> None\n\
|
|
|
|
\n\
|
|
|
|
Force the malloc() heap to clean itself up and return unused blocks\n\
|
|
|
|
to the operating system. On failure, this raises IOError.");
|
|
|
|
|
1997-08-14 03:57:53 +08:00
|
|
|
// Perform locking operations on a C runtime file descriptor.
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_locking(PyObject *self, PyObject *args)
|
1997-08-07 08:11:34 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int fd;
|
|
|
|
int mode;
|
|
|
|
long nbytes;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "iil:locking", &fd, &mode, &nbytes))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
err = _locking(fd, mode, nbytes);
|
|
|
|
Py_END_ALLOW_THREADS
|
|
|
|
if (err != 0)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
|
|
|
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1997-08-07 08:11:34 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(locking_doc,
|
|
|
|
"locking(fd, mode, nbytes) -> None\n\
|
|
|
|
\n\
|
|
|
|
Lock part of a file based on file descriptor fd from the C runtime.\n\
|
|
|
|
Raises IOError on failure. The locked region of the file extends from\n\
|
|
|
|
the current file position for nbytes bytes, and may continue beyond\n\
|
|
|
|
the end of the file. mode must be one of the LK_* constants listed\n\
|
|
|
|
below. Multiple regions in a file may be locked at the same time, but\n\
|
|
|
|
may not overlap. Adjacent regions are not merged; they must be unlocked\n\
|
|
|
|
individually.");
|
|
|
|
|
1997-08-14 03:57:53 +08:00
|
|
|
// Set the file translation mode for a C runtime file descriptor.
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_setmode(PyObject *self, PyObject *args)
|
1997-08-14 03:57:53 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int fd;
|
|
|
|
int flags;
|
|
|
|
if (!PyArg_ParseTuple(args,"ii:setmode", &fd, &flags))
|
|
|
|
return NULL;
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
flags = _setmode(fd, flags);
|
|
|
|
if (flags == -1)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
return PyLong_FromLong(flags);
|
1997-08-14 03:57:53 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(setmode_doc,
|
|
|
|
"setmode(fd, mode) -> Previous mode\n\
|
|
|
|
\n\
|
|
|
|
Set the line-end translation mode for the file descriptor fd. To set\n\
|
|
|
|
it to text mode, flags should be os.O_TEXT; for binary, it should be\n\
|
|
|
|
os.O_BINARY.");
|
|
|
|
|
1997-08-14 03:57:53 +08:00
|
|
|
// Convert an OS file handle to a C runtime file descriptor.
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_open_osfhandle(PyObject *self, PyObject *args)
|
1997-08-07 08:11:34 +08:00
|
|
|
{
|
2013-06-06 06:29:30 +08:00
|
|
|
Py_intptr_t handle;
|
2010-05-09 23:52:27 +08:00
|
|
|
int flags;
|
|
|
|
int fd;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2013-06-06 06:29:30 +08:00
|
|
|
if (!PyArg_ParseTuple(args, _Py_PARSE_INTPTR "i:open_osfhandle",
|
|
|
|
&handle, &flags))
|
2010-05-09 23:52:27 +08:00
|
|
|
return NULL;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
fd = _open_osfhandle(handle, flags);
|
|
|
|
if (fd == -1)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
return PyLong_FromLong(fd);
|
1997-08-14 03:57:53 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(open_osfhandle_doc,
|
|
|
|
"open_osfhandle(handle, flags) -> file descriptor\n\
|
|
|
|
\n\
|
|
|
|
Create a C runtime file descriptor from the file handle handle. The\n\
|
|
|
|
flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,\n\
|
|
|
|
and os.O_TEXT. The returned file descriptor may be used as a parameter\n\
|
|
|
|
to os.fdopen() to create a file object.");
|
|
|
|
|
1997-08-14 03:57:53 +08:00
|
|
|
// Convert a C runtime file descriptor to an OS file handle.
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_get_osfhandle(PyObject *self, PyObject *args)
|
1997-08-14 03:57:53 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int fd;
|
|
|
|
Py_intptr_t handle;
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd))
|
|
|
|
return NULL;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-09-05 04:53:29 +08:00
|
|
|
if (!_PyVerify_fd(fd))
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
|
|
|
|
2015-04-12 12:26:27 +08:00
|
|
|
_Py_BEGIN_SUPPRESS_IPH
|
2010-05-09 23:52:27 +08:00
|
|
|
handle = _get_osfhandle(fd);
|
2015-04-12 12:26:27 +08:00
|
|
|
_Py_END_SUPPRESS_IPH
|
2010-05-09 23:52:27 +08:00
|
|
|
if (handle == -1)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
/* technically 'handle' is not a pointer, but a integer as
|
|
|
|
large as a pointer, Python's *VoidPtr interface is the
|
|
|
|
most appropriate here */
|
|
|
|
return PyLong_FromVoidPtr((void*)handle);
|
1997-08-14 03:57:53 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(get_osfhandle_doc,
|
|
|
|
"get_osfhandle(fd) -> file handle\n\
|
|
|
|
\n\
|
|
|
|
Return the file handle for the file descriptor fd. Raises IOError\n\
|
|
|
|
if fd is not recognized.");
|
|
|
|
|
1997-08-14 03:57:53 +08:00
|
|
|
/* Console I/O */
|
|
|
|
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_kbhit(PyObject *self, PyObject *args)
|
1997-08-14 03:57:53 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int ok;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, ":kbhit"))
|
|
|
|
return NULL;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
ok = _kbhit();
|
|
|
|
return PyLong_FromLong(ok);
|
1997-08-14 03:57:53 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(kbhit_doc,
|
|
|
|
"kbhit() -> bool\n\
|
|
|
|
\n\
|
|
|
|
Return true if a keypress is waiting to be read.");
|
|
|
|
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_getch(PyObject *self, PyObject *args)
|
1997-08-14 03:57:53 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int ch;
|
|
|
|
char s[1];
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, ":getch"))
|
|
|
|
return NULL;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getch();
|
|
|
|
Py_END_ALLOW_THREADS
|
|
|
|
s[0] = ch;
|
|
|
|
return PyBytes_FromStringAndSize(s, 1);
|
1997-08-14 03:57:53 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(getch_doc,
|
|
|
|
"getch() -> key character\n\
|
|
|
|
\n\
|
2010-08-24 13:20:30 +08:00
|
|
|
Read a keypress and return the resulting character as a byte string.\n\
|
|
|
|
Nothing is echoed to the console. This call will block if a keypress is\n\
|
|
|
|
not already available, but will not wait for Enter to be pressed. If the\n\
|
|
|
|
pressed key was a special function key, this will return '\\000' or\n\
|
|
|
|
'\\xe0'; the next call will return the keycode. The Control-C keypress\n\
|
|
|
|
cannot be read with this function.");
|
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-31 11:11:23 +08:00
|
|
|
|
2008-06-13 09:09:34 +08:00
|
|
|
#ifdef _WCONIO_DEFINED
|
2007-12-11 00:18:49 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_getwch(PyObject *self, PyObject *args)
|
|
|
|
{
|
2011-11-22 09:27:30 +08:00
|
|
|
wchar_t ch;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, ":getwch"))
|
|
|
|
return NULL;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getwch();
|
|
|
|
Py_END_ALLOW_THREADS
|
2011-09-28 13:41:54 +08:00
|
|
|
return PyUnicode_FromOrdinal(ch);
|
2007-12-11 00:18:49 +08: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-31 11:11:23 +08:00
|
|
|
|
|
|
|
PyDoc_STRVAR(getwch_doc,
|
|
|
|
"getwch() -> Unicode key character\n\
|
|
|
|
\n\
|
|
|
|
Wide char variant of getch(), returning a Unicode value.");
|
2008-01-04 21:33:00 +08:00
|
|
|
#endif
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_getche(PyObject *self, PyObject *args)
|
1997-08-14 03:57:53 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int ch;
|
|
|
|
char s[1];
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, ":getche"))
|
|
|
|
return NULL;
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getche();
|
|
|
|
Py_END_ALLOW_THREADS
|
|
|
|
s[0] = ch;
|
|
|
|
return PyBytes_FromStringAndSize(s, 1);
|
1997-08-14 03:57:53 +08:00
|
|
|
}
|
1997-08-07 08:11:34 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(getche_doc,
|
|
|
|
"getche() -> key character\n\
|
|
|
|
\n\
|
|
|
|
Similar to getch(), but the keypress will be echoed if it represents\n\
|
|
|
|
a printable character.");
|
|
|
|
|
2008-06-13 09:09:34 +08:00
|
|
|
#ifdef _WCONIO_DEFINED
|
2007-12-11 00:18:49 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_getwche(PyObject *self, PyObject *args)
|
|
|
|
{
|
2011-11-22 09:27:30 +08:00
|
|
|
wchar_t ch;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, ":getwche"))
|
|
|
|
return NULL;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
|
|
ch = _getwche();
|
|
|
|
Py_END_ALLOW_THREADS
|
2011-09-28 13:41:54 +08:00
|
|
|
return PyUnicode_FromOrdinal(ch);
|
2007-12-11 00:18:49 +08: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-31 11:11:23 +08:00
|
|
|
|
|
|
|
PyDoc_STRVAR(getwche_doc,
|
|
|
|
"getwche() -> Unicode key character\n\
|
|
|
|
\n\
|
|
|
|
Wide char variant of getche(), returning a Unicode value.");
|
2008-01-04 21:33:00 +08:00
|
|
|
#endif
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_putch(PyObject *self, PyObject *args)
|
1997-08-14 03:57:53 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
char ch;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, "c:putch", &ch))
|
|
|
|
return NULL;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
_putch(ch);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1997-08-07 08:11:34 +08:00
|
|
|
}
|
1997-08-14 03:57:53 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(putch_doc,
|
|
|
|
"putch(char) -> None\n\
|
|
|
|
\n\
|
2010-08-24 13:20:30 +08:00
|
|
|
Print the byte string char to the console without buffering.");
|
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-31 11:11:23 +08:00
|
|
|
|
2008-06-13 09:09:34 +08:00
|
|
|
#ifdef _WCONIO_DEFINED
|
2007-12-11 00:18:49 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_putwch(PyObject *self, PyObject *args)
|
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int ch;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, "C:putwch", &ch))
|
|
|
|
return NULL;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
_putwch(ch);
|
|
|
|
Py_RETURN_NONE;
|
2007-12-11 00:18:49 +08: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-31 11:11:23 +08:00
|
|
|
|
|
|
|
PyDoc_STRVAR(putwch_doc,
|
|
|
|
"putwch(unicode_char) -> None\n\
|
|
|
|
\n\
|
|
|
|
Wide char variant of putch(), accepting a Unicode value.");
|
2008-01-04 21:33:00 +08:00
|
|
|
#endif
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2000-12-12 09:58:56 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_ungetch(PyObject *self, PyObject *args)
|
1997-08-14 03:57:53 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
char ch;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, "c:ungetch", &ch))
|
|
|
|
return NULL;
|
1997-08-14 03:57:53 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (_ungetch(ch) == EOF)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1997-08-14 03:57:53 +08: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-31 11:11:23 +08:00
|
|
|
PyDoc_STRVAR(ungetch_doc,
|
|
|
|
"ungetch(char) -> None\n\
|
|
|
|
\n\
|
2010-08-24 13:20:30 +08:00
|
|
|
Cause the byte string char to be \"pushed back\" into the\n\
|
|
|
|
console buffer; it will be the next character read by\n\
|
|
|
|
getch() or getche().");
|
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-31 11:11:23 +08:00
|
|
|
|
2008-06-13 09:09:34 +08:00
|
|
|
#ifdef _WCONIO_DEFINED
|
2007-12-11 00:18:49 +08:00
|
|
|
static PyObject *
|
|
|
|
msvcrt_ungetwch(PyObject *self, PyObject *args)
|
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int ch;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, "C:ungetwch", &ch))
|
|
|
|
return NULL;
|
2007-12-11 00:18:49 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (_ungetwch(ch) == WEOF)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
2007-12-11 00:18:49 +08: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-31 11:11:23 +08:00
|
|
|
|
|
|
|
PyDoc_STRVAR(ungetwch_doc,
|
|
|
|
"ungetwch(unicode_char) -> None\n\
|
|
|
|
\n\
|
|
|
|
Wide char variant of ungetch(), accepting a Unicode value.");
|
2008-01-04 21:33:00 +08:00
|
|
|
#endif
|
1997-08-07 08:11:34 +08:00
|
|
|
|
2000-12-12 09:58:56 +08:00
|
|
|
static void
|
|
|
|
insertint(PyObject *d, char *name, int value)
|
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
PyObject *v = PyLong_FromLong((long) value);
|
|
|
|
if (v == NULL) {
|
|
|
|
/* Don't bother reporting this error */
|
|
|
|
PyErr_Clear();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
PyDict_SetItemString(d, name, v);
|
|
|
|
Py_DECREF(v);
|
|
|
|
}
|
2000-12-12 09:58:56 +08:00
|
|
|
}
|
|
|
|
|
2007-08-31 15:58:36 +08:00
|
|
|
#ifdef _DEBUG
|
|
|
|
|
|
|
|
static PyObject*
|
|
|
|
msvcrt_setreportfile(PyObject *self, PyObject *args)
|
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int type, file;
|
|
|
|
_HFILE res;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "ii", &type, &file))
|
|
|
|
return NULL;
|
|
|
|
res = _CrtSetReportFile(type, (_HFILE)file);
|
|
|
|
return PyLong_FromLong((long)res);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
2007-08-31 15:58:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject*
|
|
|
|
msvcrt_setreportmode(PyObject *self, PyObject *args)
|
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int type, mode;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "ii", &type, &mode))
|
|
|
|
return NULL;
|
|
|
|
res = _CrtSetReportMode(type, mode);
|
|
|
|
if (res == -1)
|
|
|
|
return PyErr_SetFromErrno(PyExc_IOError);
|
|
|
|
return PyLong_FromLong(res);
|
2007-08-31 15:58:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject*
|
|
|
|
msvcrt_seterrormode(PyObject *self, PyObject *args)
|
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int mode, res;
|
2007-08-31 15:58:36 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, "i", &mode))
|
|
|
|
return NULL;
|
|
|
|
res = _set_error_mode(mode);
|
|
|
|
return PyLong_FromLong(res);
|
2007-08-31 15:58:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static PyObject*
|
|
|
|
seterrormode(PyObject *self, PyObject *args)
|
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
unsigned int mode, res;
|
2007-08-31 15:58:36 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
if (!PyArg_ParseTuple(args, "I", &mode))
|
|
|
|
return NULL;
|
|
|
|
res = SetErrorMode(mode);
|
|
|
|
return PyLong_FromUnsignedLong(res);
|
2007-08-31 15:58:36 +08:00
|
|
|
}
|
|
|
|
|
2000-12-12 09:58:56 +08:00
|
|
|
|
1997-08-07 08:11:34 +08:00
|
|
|
/* List of functions exported by this module */
|
|
|
|
static struct PyMethodDef msvcrt_functions[] = {
|
2010-05-09 23:52:27 +08:00
|
|
|
{"heapmin", msvcrt_heapmin, METH_VARARGS, heapmin_doc},
|
|
|
|
{"locking", msvcrt_locking, METH_VARARGS, locking_doc},
|
|
|
|
{"setmode", msvcrt_setmode, METH_VARARGS, setmode_doc},
|
|
|
|
{"open_osfhandle", msvcrt_open_osfhandle, METH_VARARGS, open_osfhandle_doc},
|
|
|
|
{"get_osfhandle", msvcrt_get_osfhandle, METH_VARARGS, get_osfhandle_doc},
|
|
|
|
{"kbhit", msvcrt_kbhit, METH_VARARGS, kbhit_doc},
|
|
|
|
{"getch", msvcrt_getch, METH_VARARGS, getch_doc},
|
|
|
|
{"getche", msvcrt_getche, METH_VARARGS, getche_doc},
|
|
|
|
{"putch", msvcrt_putch, METH_VARARGS, putch_doc},
|
|
|
|
{"ungetch", msvcrt_ungetch, METH_VARARGS, ungetch_doc},
|
|
|
|
{"SetErrorMode", seterrormode, METH_VARARGS},
|
2007-08-31 15:58:36 +08:00
|
|
|
#ifdef _DEBUG
|
2010-05-09 23:52:27 +08:00
|
|
|
{"CrtSetReportFile", msvcrt_setreportfile, METH_VARARGS},
|
|
|
|
{"CrtSetReportMode", msvcrt_setreportmode, METH_VARARGS},
|
|
|
|
{"set_error_mode", msvcrt_seterrormode, METH_VARARGS},
|
2007-08-31 15:58:36 +08:00
|
|
|
#endif
|
2008-06-13 09:09:34 +08:00
|
|
|
#ifdef _WCONIO_DEFINED
|
2010-05-09 23:52:27 +08:00
|
|
|
{"getwch", msvcrt_getwch, METH_VARARGS, getwch_doc},
|
|
|
|
{"getwche", msvcrt_getwche, METH_VARARGS, getwche_doc},
|
|
|
|
{"putwch", msvcrt_putwch, METH_VARARGS, putwch_doc},
|
|
|
|
{"ungetwch", msvcrt_ungetwch, METH_VARARGS, ungetwch_doc},
|
2008-01-04 21:33:00 +08:00
|
|
|
#endif
|
2010-05-09 23:52:27 +08:00
|
|
|
{NULL, NULL}
|
1997-08-07 08:11:34 +08:00
|
|
|
};
|
|
|
|
|
2008-06-11 13:26:20 +08:00
|
|
|
|
|
|
|
static struct PyModuleDef msvcrtmodule = {
|
2010-05-09 23:52:27 +08:00
|
|
|
PyModuleDef_HEAD_INIT,
|
|
|
|
"msvcrt",
|
|
|
|
NULL,
|
|
|
|
-1,
|
|
|
|
msvcrt_functions,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
2008-06-11 13:26:20 +08:00
|
|
|
};
|
|
|
|
|
2004-07-29 04:02:52 +08:00
|
|
|
PyMODINIT_FUNC
|
2008-06-11 13:26:20 +08:00
|
|
|
PyInit_msvcrt(void)
|
1997-08-07 08:11:34 +08:00
|
|
|
{
|
2010-05-09 23:52:27 +08:00
|
|
|
int st;
|
2012-05-14 00:19:23 +08:00
|
|
|
PyObject *d, *version;
|
2010-05-09 23:52:27 +08:00
|
|
|
PyObject *m = PyModule_Create(&msvcrtmodule);
|
|
|
|
if (m == NULL)
|
|
|
|
return NULL;
|
|
|
|
d = PyModule_GetDict(m);
|
|
|
|
|
|
|
|
/* constants for the locking() function's mode argument */
|
|
|
|
insertint(d, "LK_LOCK", _LK_LOCK);
|
|
|
|
insertint(d, "LK_NBLCK", _LK_NBLCK);
|
|
|
|
insertint(d, "LK_NBRLCK", _LK_NBRLCK);
|
|
|
|
insertint(d, "LK_RLCK", _LK_RLCK);
|
|
|
|
insertint(d, "LK_UNLCK", _LK_UNLCK);
|
|
|
|
insertint(d, "SEM_FAILCRITICALERRORS", SEM_FAILCRITICALERRORS);
|
|
|
|
insertint(d, "SEM_NOALIGNMENTFAULTEXCEPT", SEM_NOALIGNMENTFAULTEXCEPT);
|
|
|
|
insertint(d, "SEM_NOGPFAULTERRORBOX", SEM_NOGPFAULTERRORBOX);
|
|
|
|
insertint(d, "SEM_NOOPENFILEERRORBOX", SEM_NOOPENFILEERRORBOX);
|
2007-08-31 15:58:36 +08:00
|
|
|
#ifdef _DEBUG
|
2010-05-09 23:52:27 +08:00
|
|
|
insertint(d, "CRT_WARN", _CRT_WARN);
|
|
|
|
insertint(d, "CRT_ERROR", _CRT_ERROR);
|
|
|
|
insertint(d, "CRT_ASSERT", _CRT_ASSERT);
|
|
|
|
insertint(d, "CRTDBG_MODE_DEBUG", _CRTDBG_MODE_DEBUG);
|
|
|
|
insertint(d, "CRTDBG_MODE_FILE", _CRTDBG_MODE_FILE);
|
|
|
|
insertint(d, "CRTDBG_MODE_WNDW", _CRTDBG_MODE_WNDW);
|
|
|
|
insertint(d, "CRTDBG_REPORT_MODE", _CRTDBG_REPORT_MODE);
|
|
|
|
insertint(d, "CRTDBG_FILE_STDERR", (int)_CRTDBG_FILE_STDERR);
|
|
|
|
insertint(d, "CRTDBG_FILE_STDOUT", (int)_CRTDBG_FILE_STDOUT);
|
|
|
|
insertint(d, "CRTDBG_REPORT_FILE", (int)_CRTDBG_REPORT_FILE);
|
2007-08-31 15:58:36 +08: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-12-01 06:46:23 +08:00
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
/* constants for the crt versions */
|
2012-05-14 00:19:23 +08:00
|
|
|
(void)st;
|
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-12-01 06:46:23 +08:00
|
|
|
#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
|
2010-05-09 23:52:27 +08:00
|
|
|
st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
|
|
|
|
_VC_ASSEMBLY_PUBLICKEYTOKEN);
|
|
|
|
if (st < 0) return NULL;
|
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-12-01 06:46:23 +08:00
|
|
|
#endif
|
|
|
|
#ifdef _CRT_ASSEMBLY_VERSION
|
2010-05-09 23:52:27 +08:00
|
|
|
st = PyModule_AddStringConstant(m, "CRT_ASSEMBLY_VERSION",
|
|
|
|
_CRT_ASSEMBLY_VERSION);
|
|
|
|
if (st < 0) return NULL;
|
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-12-01 06:46:23 +08:00
|
|
|
#endif
|
|
|
|
#ifdef __LIBRARIES_ASSEMBLY_NAME_PREFIX
|
2010-05-09 23:52:27 +08:00
|
|
|
st = PyModule_AddStringConstant(m, "LIBRARIES_ASSEMBLY_NAME_PREFIX",
|
|
|
|
__LIBRARIES_ASSEMBLY_NAME_PREFIX);
|
|
|
|
if (st < 0) return NULL;
|
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-12-01 06:46:23 +08:00
|
|
|
#endif
|
|
|
|
|
2012-05-14 00:19:23 +08: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)
|
|
|
|
version = PyUnicode_FromFormat("%d.%d.%d.%d", _VC_CRT_MAJOR_VERSION,
|
|
|
|
_VC_CRT_MINOR_VERSION,
|
|
|
|
_VC_CRT_BUILD_VERSION,
|
|
|
|
_VC_CRT_RBUILD_VERSION);
|
|
|
|
st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version);
|
|
|
|
if (st < 0) return NULL;
|
|
|
|
#endif
|
|
|
|
|
2010-05-09 23:52:27 +08:00
|
|
|
return m;
|
1997-08-07 08:11:34 +08:00
|
|
|
}
|