Skip to content

[WIP] Remove libffi msvc #3806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,24 +399,35 @@ static PyCArgObject *
StructUnionType_paramfunc(CDataObject *self)
{
PyCArgObject *parg;
CDataObject *copied_self;
StgDictObject *stgdict;

if (self->b_size > sizeof(void*)) {
void *new_ptr = PyMem_Malloc(self->b_size);
if (new_ptr == NULL)
return NULL;
memcpy(new_ptr, self->b_ptr, self->b_size);
copied_self = (CDataObject *)PyCData_AtAddress(
(PyObject *)Py_TYPE(self), new_ptr);
copied_self->b_needsfree = 1;
} else {
copied_self = self;
Py_INCREF(copied_self);
}

parg = PyCArgObject_new();
if (parg == NULL)
if (parg == NULL) {
Py_DECREF(copied_self);
return NULL;
}

parg->tag = 'V';
stgdict = PyObject_stgdict((PyObject *)self);
stgdict = PyObject_stgdict((PyObject *)copied_self);
assert(stgdict); /* Cannot be NULL for structure/union instances */
parg->pffi_type = &stgdict->ffi_type_pointer;
/* For structure parameters (by value), parg->value doesn't contain the structure
data itself, instead parg->value.p *points* to the structure's data
See also _ctypes.c, function _call_function_pointer().
*/
parg->value.p = self->b_ptr;
parg->size = self->b_size;
Py_INCREF(self);
parg->obj = (PyObject *)self;
parg->value.p = copied_self->b_ptr;
parg->size = copied_self->b_size;
parg->obj = (PyObject *)copied_self;
return parg;
}

Expand Down
4 changes: 2 additions & 2 deletions Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ static int _call_function_pointer(int flags,
ffi_cif cif;
int cc;
#ifdef MS_WIN32
int delta;
int delta = 0;
#ifndef DONT_USE_SEH
DWORD dwExceptionCode = 0;
EXCEPTION_RECORD record;
Expand Down Expand Up @@ -800,7 +800,7 @@ static int _call_function_pointer(int flags,
#ifndef DONT_USE_SEH
__try {
#endif
delta =
// delta =
#endif
ffi_call(&cif, (void *)pProc, resmem, avalues);
#ifdef MS_WIN32
Expand Down
20 changes: 0 additions & 20 deletions Modules/_ctypes/libffi_msvc/LICENSE

This file was deleted.

Loading