mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Merged revisions 55129-55131 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk/Lib/ctypes ........ r55129 | thomas.heller | 2007-05-04 21:54:22 +0200 (Fr, 04 Mai 2007) | 3 lines Do not truncate 64-bit pointers to 32-bit integers. Fixes SF #1703286, will backport to release25-maint. ........ r55131 | thomas.heller | 2007-05-04 21:56:32 +0200 (Fr, 04 Mai 2007) | 1 line Oops, these tests do not run on Windows CE. ........
This commit is contained in:
parent
bc9e5dcf88
commit
11c58c4c8d
4 changed files with 47 additions and 11 deletions
|
|
@ -1111,10 +1111,10 @@ static char free_library_doc[] =
|
|||
Free the handle of an executable previously loaded by LoadLibrary.\n";
|
||||
static PyObject *free_library(PyObject *self, PyObject *args)
|
||||
{
|
||||
HMODULE hMod;
|
||||
if (!PyArg_ParseTuple(args, "i:FreeLibrary", &hMod))
|
||||
void *hMod;
|
||||
if (!PyArg_ParseTuple(args, PY_VOID_P_CODE ":FreeLibrary", &hMod))
|
||||
return NULL;
|
||||
if (!FreeLibrary(hMod))
|
||||
if (!FreeLibrary((HMODULE)hMod))
|
||||
return PyErr_SetFromWindowsErr(GetLastError());
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
|
@ -1233,9 +1233,9 @@ static PyObject *py_dl_open(PyObject *self, PyObject *args)
|
|||
|
||||
static PyObject *py_dl_close(PyObject *self, PyObject *args)
|
||||
{
|
||||
void * handle;
|
||||
void *handle;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i:dlclose", &handle))
|
||||
if (!PyArg_ParseTuple(args, PY_VOID_P_CODE ":dlclose", &handle))
|
||||
return NULL;
|
||||
if (dlclose(handle)) {
|
||||
PyErr_SetString(PyExc_OSError,
|
||||
|
|
@ -1252,7 +1252,7 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args)
|
|||
void *handle;
|
||||
void *ptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name))
|
||||
if (!PyArg_ParseTuple(args, PY_VOID_P_CODE "s:dlsym", &handle, &name))
|
||||
return NULL;
|
||||
ptr = ctypes_dlsym(handle, name);
|
||||
if (!ptr) {
|
||||
|
|
@ -1260,7 +1260,7 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args)
|
|||
ctypes_dlerror());
|
||||
return NULL;
|
||||
}
|
||||
return Py_BuildValue("i", ptr);
|
||||
return PyLong_FromVoidPtr(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1272,12 +1272,12 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
call_function(PyObject *self, PyObject *args)
|
||||
{
|
||||
PPROC func;
|
||||
void *func;
|
||||
PyObject *arguments;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyArg_ParseTuple(args,
|
||||
"iO!",
|
||||
PY_VOID_P_CODE "O!",
|
||||
&func,
|
||||
&PyTuple_Type, &arguments))
|
||||
return NULL;
|
||||
|
|
@ -1303,12 +1303,12 @@ call_function(PyObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
call_cdeclfunction(PyObject *self, PyObject *args)
|
||||
{
|
||||
PPROC func;
|
||||
void *func;
|
||||
PyObject *arguments;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyArg_ParseTuple(args,
|
||||
"iO!",
|
||||
PY_VOID_P_CODE "O!",
|
||||
&func,
|
||||
&PyTuple_Type, &arguments))
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@ typedef int Py_ssize_t;
|
|||
#define PY_LONG_LONG LONG_LONG
|
||||
#endif
|
||||
|
||||
#if SIZEOF_VOID_P == SIZEOF_LONG
|
||||
#define PY_VOID_P_CODE "k"
|
||||
#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG)
|
||||
#define PY_VOID_P_CODE "K"
|
||||
#endif
|
||||
|
||||
typedef struct tagPyCArgObject PyCArgObject;
|
||||
typedef struct tagCDataObject CDataObject;
|
||||
typedef PyObject *(* GETFUNC)(void *, unsigned size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue