Commit graph

71 commits

Author SHA1 Message Date
Thomas Heller
5becdbee96 Patch #1517790: It is now possible to use custom objects in the ctypes
foreign function argtypes sequence as long as they provide a
from_param method, no longer is it required that the object is a
ctypes type.
2006-07-06 08:48:35 +00:00
Thomas Heller
43d9a58dfd Revert the change done in svn revision 47206:
Add a new function uses_seh() to the _ctypes extension module.  This
will return True if Windows Structured Exception handling (SEH) is
used when calling functions, False otherwise.
2006-07-06 07:50:18 +00:00
Thomas Heller
9ba7ca8229 Fix the bitfield test when _ctypes is compiled with MingW. Structures
containing bitfields may have different layout on MSVC and MingW .
2006-07-05 09:13:56 +00:00
Ronald Oussoren
b4a6a566ff Sync the darwin/x86 port libffi with the copy in PyObjC. This fixes a number
of bugs in that port. The most annoying ones were due to some subtle differences
between the document ABI and the actual implementation :-(

(there are no python unittests that fail without this patch, but without it
 some of libffi's unittests fail).
2006-07-04 12:30:22 +00:00
Thomas Heller
f780be4239 Add a new function uses_seh() to the _ctypes extension module. This
will return True if Windows Structured Exception handling (SEH) is
used when calling functions, False otherwise.

Currently, only MSVC supports SEH.

Fix the test so that it doesn't crash when run with MingW compiled
_ctypes.  Note that two tests are still failing when mingw is used, I
suspect structure layout differences and function calling conventions
between MSVC and MingW.
2006-07-03 08:08:14 +00:00
Thomas Heller
638f7addf3 Fixes so that _ctypes can be compiled with the MingW compiler.
It seems that the definition of '__attribute__(x)' was responsible for
the compiler ignoring the '__fastcall' attribute on the
ffi_closure_SYSV function in libffi_msvc/ffi.c, took me quite some
time to figure this out.
2006-07-03 08:04:05 +00:00
Thomas Heller
dd854e917f Cleanup: Remove commented out code. 2006-07-03 07:58:09 +00:00
Tim Peters
08612926a1 Remove now-unused fidding with PY_FORMAT_SIZE_T. 2006-06-30 18:34:51 +00:00
Thomas Heller
730199275a Revert the use of PY_FORMAT_SIZE_T in PyErr_Format. 2006-06-30 17:44:54 +00:00
Neal Norwitz
3f2748e775 Silence compiler warning 2006-06-30 07:32:16 +00:00
Thomas Heller
bde081329b Protect the thread api calls in the _ctypes extension module within
#ifdef WITH_THREADS/#endif blocks.  Found by Sam Rushing.
2006-06-29 18:34:15 +00:00
Thomas Heller
c2da994585 Add pep-291 compatibility markers. 2006-06-12 20:56:48 +00:00
Thomas Heller
ee3ea5418e I don't know how that happend, but the entire file contents was
duplicated.  Thanks to Simon Percivall for the heads up.
2006-06-12 06:05:57 +00:00
Thomas Heller
0d5d222959 Release the GIL during COM method calls, to avoid deadlocks in
Python coded COM objects.
2006-06-11 17:04:22 +00:00
Thomas Heller
9af2b44805 Handle failure of PyMem_Realloc. 2006-06-10 22:01:50 +00:00
Thomas Heller
9123edcc63 Don't use C++ comment. 2006-06-10 21:56:03 +00:00
Thomas Heller
eb6dcf6b0d Fix the second occurrence of the problematic printf format. 2006-06-10 21:17:58 +00:00
Thomas Heller
5218ab263a Fix a wrong printf format. 2006-06-10 21:07:19 +00:00
Thomas Heller
45f59ab3ee Upgrade to ctypes version 0.9.9.7.
Summary of changes:

- support for 'variable sized' data
- support for anonymous structure/union fields
- fix severe bug with certain arrays or structures containing more than 256 fields
2006-06-10 19:51:46 +00:00
Thomas Heller
861acee048 Fix for foreign functions returning small structures on 64-bit big
endian machines.  Should fix the remaininf failure in the PPC64
Debian buildbot.

Thanks to Matthias Klose for providing access to a machine to debug
and test this.
2006-06-07 20:43:06 +00:00
Thomas Heller
b1998bc860 Use the same big-endian hack as in _ctypes/callproc.c for callback functions.
This fixes the callback function tests that return float.
2006-06-06 19:25:13 +00:00
Thomas Heller
d8714dedfa Add a hack so that foreign functions returning float now do work on 64-bit
big endian platforms.
2006-06-06 18:50:46 +00:00
Thomas Heller
07347d6efc Damn - the sentinel was missing. And fix another silly mistake. 2006-06-06 11:54:32 +00:00
Thomas Heller
ecc3e67b98 Convert CFieldObject tp_members to tp_getset, since there is no
structmember typecode for Py_ssize_t fields.  This should fix some of
the errors on the PPC64 debian machine (64-bit, big endian).

Assigning to readonly fields now raises AttributeError instead of
TypeError, so the testcase has to be changed as well.
2006-06-06 11:34:33 +00:00
Thomas Heller
bd16bce81f PyTuple_Pack is not available in Python 2.3, but ctypes must stay
compatible with that.
2006-05-31 11:37:58 +00:00
Georg Brandl
7784f12d74 Replace Py_BuildValue("OO") by PyTuple_Pack. 2006-05-26 20:04:44 +00:00
Bob Ippolito
ad647859f4 Fix distutils so that libffi will cross-compile between darwin/x86 and darwin/ppc 2006-05-26 14:07:23 +00:00
Bob Ippolito
45c6472f99 Add missing files from x86 darwin ctypes patch 2006-05-25 21:58:05 +00:00
Ronald Oussoren
f5bc414334 Fix minor typo in prep_cif.c 2006-05-25 21:30:54 +00:00
Bob Ippolito
66c0935d67 enable darwin/x86 support for libffi and hence ctypes (doesn't yet support --enable-universalsdk) 2006-05-25 19:59:56 +00:00
Thomas Heller
9b83fc67ea Clean up. 2006-05-05 19:14:24 +00:00
Thomas Heller
21a929f5ab Export the 'free' standard C function for use in the test suite. 2006-05-05 18:42:14 +00:00
Hye-Shik Chang
f4795c82df Fix build on MIPS for libffi. I haven't tested this yet because I
don't have an access on MIPS machines.  Will be tested by buildbot. :)
2006-04-26 19:20:26 +00:00
Thomas Heller
4e1777de63 Fix compiler warnings on Darwin.
Patch by Brett Canon, see
https://sourceforge.net/tracker/?func=detail&atid=532156&aid=1475959&group_id=71702
2006-04-25 18:26:08 +00:00
Thomas Heller
4b75a7c1cf Merge in changes from ctypes 0.9.9.6 upstream version. 2006-04-21 16:48:56 +00:00
Thomas Heller
b6dfaed903 Rename remaining StgDictObject's ffi_type fields to ffi_type_pointer. 2006-04-18 20:09:27 +00:00
Skip Montanaro
058be9adbc C++ compiler cleanup: the typical few casts, and ... C++ didn't like that
the StgDictObject's ffi_type member had the same name as its type.  I
changed that to ffi_type_pointer.  Feel free to change it to something else
more meaningful, just not ffi_type.
2006-04-18 19:45:17 +00:00
Thomas Heller
9d89299fea Fix refcounting.
This makes 'import ctypes; reload(ctypes)' no longer leak reference counts.
2006-04-18 14:57:39 +00:00
Thomas Heller
eb6f1835b1 Fix for FreeBSD. Fixes http://python.org/sf/1470353.
Looks like a libffi bug.
2006-04-15 20:23:54 +00:00
Thomas Heller
55d031ef23 Fix for a bug found by Armin Rigo, plus test.
https://sourceforge.net/tracker/?func=detail&atid=532154&aid=1467852&group_id=71702
2006-04-12 19:07:36 +00:00
Neal Norwitz
b183a25c29 Fix some warnings on HP-UX when using cc/aCC 2006-04-10 01:03:32 +00:00
Thomas Heller
fff61ea025 Expose RTLD_LOCAL and RTLD_GLOBAL always from the _ctypes extension module.
If RTLD_LOCAL is not #defined in any header file (Windows), set it to 0.
If RTLD_GLOBAL is not #defined, set it equal to RTLD_LOCAL.

This should fix ctypes on cygwin.
2006-04-06 15:23:16 +00:00
Thomas Heller
430947ac66 Replace a few more 'char' types with 'signed char', to fix test failures
on platforms (ppc debian) where 'char' is unsigned.
2006-04-06 09:02:58 +00:00
Neal Norwitz
915ae41b3a Handle error conditions from PyString_ConcatAndDel(). 2006-04-06 08:06:52 +00:00
Neal Norwitz
b038333d4b Handle ssize_t
No need to INCREF then let PyString_ConcatAndDel() DECREF.  Just
use PyString_Concat().
Handle error condition if we can't concat.
2006-04-06 08:05:53 +00:00
Thomas Heller
3c423a04ba Explicitely use 'signed char', to avoid problems on platforms with unsigned char type. 2006-04-05 20:34:18 +00:00
Thomas Heller
0890de3be0 Explicitely use 'signed char', to avoid problems on platforms with unsigned char type. 2006-04-05 19:51:19 +00:00
Thomas Heller
cdab455f9a Try to fix the build on Mac OS X 10.3. The 'live_support' segment
attribute is not supported in this version.
2006-04-03 20:12:41 +00:00
Thomas Heller
db5483be64 Try to fix the tests on OpenBSD. Apparently OpenBSD passes
structure parameters differently than other posix-like systems.
2006-04-03 16:19:45 +00:00
Thomas Heller
3987df5adf Try to build _ctypes on x86 openbsd. 2006-03-30 11:51:58 +00:00