From d1d013c01c268d869597b35cbcd8b5d7c5baf2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 28 Sep 2011 07:41:54 +0200 Subject: Implement PEP 393. --- PC/msvcrtmodule.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'PC/msvcrtmodule.c') diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index 166df036f2..e5a0a177bc 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -212,7 +212,6 @@ static PyObject * msvcrt_getwch(PyObject *self, PyObject *args) { Py_UNICODE ch; - Py_UNICODE u[1]; if (!PyArg_ParseTuple(args, ":getwch")) return NULL; @@ -220,8 +219,7 @@ msvcrt_getwch(PyObject *self, PyObject *args) Py_BEGIN_ALLOW_THREADS ch = _getwch(); Py_END_ALLOW_THREADS - u[0] = ch; - return PyUnicode_FromUnicode(u, 1); + return PyUnicode_FromOrdinal(ch); } PyDoc_STRVAR(getwch_doc, @@ -257,7 +255,6 @@ static PyObject * msvcrt_getwche(PyObject *self, PyObject *args) { Py_UNICODE ch; - Py_UNICODE s[1]; if (!PyArg_ParseTuple(args, ":getwche")) return NULL; @@ -265,8 +262,7 @@ msvcrt_getwche(PyObject *self, PyObject *args) Py_BEGIN_ALLOW_THREADS ch = _getwche(); Py_END_ALLOW_THREADS - s[0] = ch; - return PyUnicode_FromUnicode(s, 1); + return PyUnicode_FromOrdinal(ch); } PyDoc_STRVAR(getwche_doc, -- cgit v1.2.1 From 05407577effc3f36d9b63c12b8e754eb86e8e3f6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 22 Nov 2011 02:27:30 +0100 Subject: Use the new Unicode API * Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0) * Replce PyUnicode_FromUnicode(str, len) by PyUnicode_FromWideChar(str, len) * Replace Py_UNICODE by wchar_t * posix_putenv() uses PyUnicode_FromFormat() to create the string, instead of PyUnicode_FromUnicode() + _snwprintf() --- PC/msvcrtmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'PC/msvcrtmodule.c') diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index e5a0a177bc..f277b0a64d 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -211,7 +211,7 @@ cannot be read with this function."); static PyObject * msvcrt_getwch(PyObject *self, PyObject *args) { - Py_UNICODE ch; + wchar_t ch; if (!PyArg_ParseTuple(args, ":getwch")) return NULL; @@ -254,7 +254,7 @@ a printable character."); static PyObject * msvcrt_getwche(PyObject *self, PyObject *args) { - Py_UNICODE ch; + wchar_t ch; if (!PyArg_ParseTuple(args, ":getwche")) return NULL; -- cgit v1.2.1 From 24c2b4159481ae98df26a6dc727e4405d3d95b1d Mon Sep 17 00:00:00 2001 From: Brian Curtin Date: Sun, 13 May 2012 11:19:23 -0500 Subject: Fix #13210. Port the Windows build from VS2008 to VS2010. --- PC/msvcrtmodule.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'PC/msvcrtmodule.c') diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index f277b0a64d..04d2088d29 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -27,6 +27,8 @@ #ifdef _MSC_VER #if _MSC_VER >= 1500 && _MSC_VER < 1600 #include +#elif _MSC_VER >= 1600 +#include #endif #endif @@ -464,7 +466,7 @@ PyMODINIT_FUNC PyInit_msvcrt(void) { int st; - PyObject *d; + PyObject *d, *version; PyObject *m = PyModule_Create(&msvcrtmodule); if (m == NULL) return NULL; @@ -494,6 +496,7 @@ PyInit_msvcrt(void) #endif /* constants for the crt versions */ + (void)st; #ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN", _VC_ASSEMBLY_PUBLICKEYTOKEN); @@ -510,5 +513,15 @@ PyInit_msvcrt(void) if (st < 0) return NULL; #endif + /* 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 + return m; } -- cgit v1.2.1