Commit Graph

184 Commits

Author SHA1 Message Date
Georg Brandl a6b79f3b11 Add missing return type to dealloc. 2008-04-26 18:32:17 +00:00
Thomas Heller 6ad5fbb7ea Add from_buffer and from_buffer_copy class methods to ctypes types. 2008-04-25 15:44:16 +00:00
Thomas Heller bf027c48c8 Remove cyclic reference in CFuncPtr instances; see issue #2682.
Backport candidate for the release25-maint branch.
2008-04-24 18:14:19 +00:00
Thomas Heller 046e6a43ff Issue #2616: Implement ctypes.pointer() and ctypes.POINTER() in C for
better performance.
2008-04-14 16:10:07 +00:00
Thomas Heller d3ed492164 Performance improvements. 2008-04-11 14:20:26 +00:00
Thomas Heller 12c4e6478a Move backwards compatibility macro to the correct place;
PyIndex_Check() was introduced in Python 2.5.
2008-04-11 13:05:38 +00:00
Thomas Heller c4ef47611f More files from libffi 3.0.5.
Removed libffi.pc.in because it is not needed for ctypes.
2008-04-04 19:14:42 +00:00
Thomas Heller e1929d5133 Sync with files from the just released libffi 3.0.5 version. 2008-04-04 16:01:54 +00:00
Thomas Heller 8e8ba151dd Issue #2543: Make ctypes compatible (again) with Python 2.3, 2.4, and 2.5. 2008-04-04 08:35:44 +00:00
Thomas Heller fffd939056 Make _ctypes.c PY_SSIZE_T_CLEAN. 2008-03-25 21:18:39 +00:00
Thomas Heller 50a24d8bfd Include <alloca.h> on Solaris, see issue #1506.
It would probably be better to have a configure test for that, but
this is outside of my configure expertise.
2008-03-18 15:03:17 +00:00
Thomas Heller 41e22ff5cc Remove unneeded initializer. 2008-03-14 21:06:21 +00:00
Thomas Heller f3c0559b5e Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
2008-03-05 15:34:29 +00:00
Thomas Heller a23aede562 Try to fix the build for PY_LINUX. 2008-03-04 20:21:42 +00:00
Thomas Heller 8bdf81d2df Merged changes from libffi3-branch.
The bundled libffi copy is now in sync with the recently released
libffi3.0.4 version, apart from some small changes to
Modules/_ctypes/libffi/configure.ac.

I gave up on using libffi3 files on os x.
Instead, static configuration with files from pyobjc is used.
2008-03-04 20:09:11 +00:00
Neal Norwitz ed0a593a10 Get ctypes working on the Alpha (Tru64). The problem was that there
were two module_methods and the one used depended on the order the
modules were loaded.  By making the test module_methods static,
it is not exported and the correct version is picked up.
2008-02-24 07:21:56 +00:00
Thomas Heller 981f31860b configure.ac: Remove the configure check for _Bool, it is already done in the
top-level Python configure script.
configure, fficonfig.h.in: regenerated.
2008-02-21 18:28:48 +00:00
Thomas Heller a06a1a88ee Add pickle support to ctypes types. 2008-02-13 20:21:53 +00:00
Brett Cannon 8352585909 Make sure a switch statement does not have repetitive case statements.
Error found through LLVM post-2.1 svn.
2008-02-07 22:27:10 +00:00
Thomas Heller 55b8c3e26f Fixed refcounts and error handling.
Should not be merged to py3k branch.
2008-02-06 20:29:17 +00:00
Thomas Heller 99120c4f7e Revert rev. 59925, it breaks comtypes (I need to further examine this). 2008-01-28 08:44:13 +00:00
Christian Heimes d7e1b2bd17 static PyObject* variables should use PyString_InternFromString() instead of PyObject_FromString() to store a python string in a function level static var. 2008-01-28 02:07:53 +00:00
Neal Norwitz b3c8243c47 Update to newer version of ffi. Fixes crashes and test failures of longdouble 2008-01-27 17:10:43 +00:00
Thomas Heller 5ca924038d Invert the checks in get_[u]long and get_[u]longlong. The intent was
to not accept float types; the result was that integer-like objects
were not accepted.

Ported from release25-maint.
2008-01-24 19:15:02 +00:00
Thomas Heller 71dba4ccee Replace Py_BuildValue with PyTuple_Pack because it is faster.
Also add a missing DECREF.
2008-01-24 18:54:12 +00:00
Thomas Heller e4c03e4520 Use a PyDictObject again for the array type cache; retrieving items
from the WeakValueDictionary was slower by nearly a factor of 3.

To avoid leaks, weakref proxies for the array types are put into the
cache dict, with weakref callbacks that removes the entries when the
type goes away.
2008-01-24 18:36:27 +00:00
Brett Cannon a35a8b11c3 Fix a function pointer declaration to silence the compiler. 2008-01-17 18:45:10 +00:00
Thomas Heller 0f75f9847a Use 'g' instead of 'D' as the ctypes typecode for c_longdouble, for
compliance with PEP 3118.
2008-01-16 20:34:37 +00:00
Thomas Heller 415c1e36a9 Raise a TypeError instead of a ValueError when too many initializers
are used in a Structure or Union constructor.
2008-01-16 19:45:51 +00:00
Thomas Heller 02ec289f3e Raise a TypeError if conflicting positional and named arguments are
passed to a Structure or Union constructor.
2008-01-16 19:37:33 +00:00
Thomas Heller 902d30752f Convert the internal ctypes array type cache to a WeakValueDict so
that array types do not live longer than needed.
2008-01-16 19:16:27 +00:00
Thomas Heller 7a66a1becc Issue 1821: configure libffi for amd64 on FreeeBSD. 2008-01-14 10:35:28 +00:00
Amaury Forgeot d'Arc 7cdf5f5c31 ?Why did my tests not notice this before?
Slots inheritance is very different from OO inheritance.
This code lead to infinite recursion on classes derived from StructType.
2008-01-14 01:07:27 +00:00
Amaury Forgeot d'Arc 08ccf202e6 As discussed in issue 1700288:
ctypes takes some liberties when creating python types: it modifies the types'
__dict__ directly, bypassing all the machinery of type objects which deal with
special methods.  And this broke recent optimisations of method lookup.
Now we try to modify the type with more "official" functions.
2008-01-14 00:22:44 +00:00
Thomas Heller 43617bc610 Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.

Will backport to release25-maint.
2008-01-11 20:29:19 +00:00
Thomas Heller c682614df0 Raise an error instead of crashing with a segfault when a NULL
function pointer is called.

Will backport to release25-maint.
2008-01-11 19:34:06 +00:00
Thomas Heller 41f278ffa5 Use relative instead of absolute filenames in the C-level tracebacks.
This prevents traceback prints pointing to files in this way:

  File "\loewis\25\python\Modules\_ctypes\callbacks.c", line 206, in 'calling callback function'
2008-01-08 15:15:09 +00:00
Christian Heimes 000a074c95 Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
2008-01-03 22:16:32 +00:00
Christian Heimes e93237dfcc #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available. 2007-12-19 02:37:44 +00:00
Thomas Heller 153038efa4 Issue #1642: Fix segfault in ctypes when trying to delete attributes. 2007-12-18 19:00:34 +00:00
Christian Heimes 2518b25578 Fixed a warning in _codecs_iso2022.c and some non C89 conform // comments. 2007-12-14 03:02:34 +00:00
Thomas Heller 8fc2a34014 Remove unused global variable, and remove unneeded COMError.__str__
implementation in C.
2007-11-27 12:22:11 +00:00
Thomas Heller 469b2a52cd ffi_type_longdouble may be already #defined.
See issue 1324.
2007-10-25 19:47:32 +00:00
Thomas Heller 91ac42243c Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.

Ported from release25-maint branch.
2007-10-19 18:11:41 +00:00
Neal Norwitz c740d834ee Get rid of warnings on a bunch of platforms by using a proper prototype. 2007-10-12 03:01:30 +00:00
Thomas Heller 49c7c71d9f Remove unneeded #include. 2007-09-07 09:30:40 +00:00
Thomas Heller 2825b2ea44 Add a 'c_longdouble' type to the ctypes module. 2007-09-07 06:32:17 +00:00
Matthias Klose 38336406eb - Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*. 2007-09-04 20:46:02 +00:00
Thomas Wouters dcb3c382ac Somewhat-preliminary slice-object and extended slicing support for ctypes.
The exact behaviour of omitted and negative indices for the Pointer type may
need a closer look (especially as it's subtly different from simple slices)
but there's time yet before 2.6, and not enough before 3.0a1 :-)
2007-08-30 21:01:17 +00:00
Martin v. Löwis 6819210b9e PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00