summaryrefslogtreecommitdiffstats
path: root/PC/msvcrtmodule.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-06-30 17:48:51 (GMT)
committerFred Drake <fdrake@acm.org>2000-06-30 17:48:51 (GMT)
commit25e1726d311d506b63de15b2b88a5e5fde0eda76 (patch)
treeb125702ecd1633ffd731cba5e9acb3a75786f594 /PC/msvcrtmodule.c
parent7efcafb994a5e97bf458b3138a7694a3c41b7ca7 (diff)
downloadcpython-25e1726d311d506b63de15b2b88a5e5fde0eda76.zip
cpython-25e1726d311d506b63de15b2b88a5e5fde0eda76.tar.gz
cpython-25e1726d311d506b63de15b2b88a5e5fde0eda76.tar.bz2
[*** Not tested as I don't have Windows running right now! ***]
Trent Mick <trentm@activestate.com>: Fix PC/msvcrtmodule.c and PC/winreg.c for Win64. Basically: - sizeof(HKEY) > sizeof(long) on Win64, so use PyLong_FromVoidPtr() instead of PyInt_FromLong() to return HKEY values on Win64 - Check for string overflow of an arbitrary registry value (I know that ensuring that a registry value does not overflow 2**31 characters seems ridiculous but it is *possible*). Closes SourceForge patch #100517.
Diffstat (limited to 'PC/msvcrtmodule.c')
-rwxr-xr-xPC/msvcrtmodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index 21be21a..613e173 100755
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -90,7 +90,7 @@ static PyObject *msvcrt_open_osfhandle(PyObject *self, PyObject *args)
static PyObject *msvcrt_get_osfhandle(PyObject *self, PyObject *args)
{
int fd;
- long handle;
+ intptr_t handle;
if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd))
return NULL;
@@ -99,7 +99,10 @@ static PyObject *msvcrt_get_osfhandle(PyObject *self, PyObject *args)
if (handle == -1)
return PyErr_SetFromErrno(PyExc_IOError);
- return PyInt_FromLong(handle);
+ /* 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);
}
/* Console I/O */