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
8e8ba151dd
Issue #2543 : Make ctypes compatible (again) with Python 2.3, 2.4, and 2.5.
2008-04-04 08:35:44 +00:00
Christian Heimes
c5f05e45cf
Patch #2167 from calvin: Remove unused imports
2008-02-23 17:40:11 +00:00
Thomas Heller
8982cf5484
Replace 'has_key()' with 'in'.
...
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
2008-02-21 18:52:20 +00:00
Thomas Heller
4516451aec
Make the test somewhat clearer (I hope).
2008-02-13 20:36:51 +00:00
Thomas Heller
a06a1a88ee
Add pickle support to ctypes types.
2008-02-13 20:21:53 +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
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
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
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
153038efa4
Issue #1642 : Fix segfault in ctypes when trying to delete attributes.
2007-12-18 19:00:34 +00:00
Thomas Heller
03fd077482
Enable the full ctypes c_longdouble tests again.
2007-11-02 19:11:23 +00:00
Thomas Heller
e7becc5007
Added unittest for calling a function with paramflags (backport from py3k branch).
2007-10-24 19:50:45 +00:00
Thomas Heller
0b7120258a
Disable some tests that fail on the 'ppc Debian unstable' buildbot to
...
find out if they cause the segfault on the 'alpha Debian' machine.
2007-09-11 19:17:48 +00:00
Thomas Heller
2825b2ea44
Add a 'c_longdouble' type to the ctypes module.
2007-09-07 06:32:17 +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
Thomas Heller
ad0cfe3dd7
Do not try to load the GLUT library in the ctypes tests. This test
...
adds little value, but has a large problem on OS X, as explained in
SF# 1581906.
2007-07-13 16:50:43 +00:00
Thomas Heller
1fd1cc5be2
Add tests for _ctypes.COMError.
2007-07-13 14:18:06 +00:00
Thomas Heller
1b9e041812
Make this test work with older Python releases where struct has no 't' format character.
2007-06-08 16:10:27 +00:00
Thomas Heller
2ebc4d8054
Oops, these tests do not run on Windows CE.
2007-05-04 19:56:32 +00:00
Thomas Heller
1ad576c267
Do not truncate 64-bit pointers to 32-bit integers.
...
Fixes SF #1703286 , will backport to release25-maint.
2007-05-04 19:54:22 +00:00
Thomas Heller
0455214f1c
Fix some ctypes test crashes, when running with a debug Python
...
version on win64 by using proper argtypes and restype function
attributes.
2007-05-04 07:14:39 +00:00
Neal Norwitz
0d4c06e06e
Whitespace normalization. Ugh, we really need to do this more often.
...
You might want to review this change as it's my first time. Be gentle. :-)
2007-04-25 06:30:05 +00:00
Thomas Heller
5dc4fe09b7
Patch #1649190 : Adding support for _Bool to ctypes as c_bool, by David Remahl.
2007-03-13 20:42:52 +00:00
Thomas Heller
2456a3c02a
Bug #1651235 : When a tuple was passed to a ctypes function call,
...
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
2007-03-09 20:39:22 +00:00
Thomas Heller
c2f7725c86
Fix bug #1646630 : ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
...
returned string up to the first NUL character.
2007-03-09 19:21:28 +00:00
Thomas Heller
572104ff5c
Avoid warnings in the test suite because ctypes.wintypes cannot be
...
imported on non-windows systems.
2007-01-12 20:08:19 +00:00
Thomas Heller
8138c26a83
Fixes for 64-bit Windows: In ctypes.wintypes, correct the definitions
...
of HANDLE, WPARAM, LPARAM data types. Make parameterless foreign
function calls work.
2007-01-11 21:18:56 +00:00
Brett Cannon
8211297a7e
Fix a bad assumption that all objects assigned to '__loader__' on a module
...
will have a '_files' attribute.
2006-12-06 23:38:48 +00:00
Thomas Heller
25d208bd46
Fix bug #1598620 : A ctypes structure cannot contain itself.
2006-11-24 18:45:39 +00:00
Thomas Heller
d2ea4a2584
ctypes callback functions only support 'fundamental' result types.
...
Check this and raise an error when something else is used - before
this change ctypes would hang or crash when such a callback was
called. This is a partial fix for #1574584 .
Will backport to release25-maint.
2006-10-17 19:30:48 +00:00
Thomas Heller
2244af596a
The cast function did not accept c_char_p or c_wchar_p instances
...
as first argument, and failed with a 'bad argument to internal function'
error message.
2006-09-07 19:09:54 +00:00
Thomas Heller
fdb62f0e5f
Anonymous structure fields that have a bit-width specified did not work,
...
and they gave a strange error message from PyArg_ParseTuple:
function takes exactly 2 arguments (3 given).
With tests.
2006-09-07 18:56:28 +00:00
Thomas Heller
98619f267c
Port _ctypes.pyd to win64 on AMD64.
2006-08-25 07:27:33 +00:00
Thomas Heller
b4a0cf17c4
Remove the special casing of Py_None when converting the return value
...
of the Python part of a callback function to C. If it cannot be
converted, call PyErr_WriteUnraisable with the exception we got.
Before, arbitrary data has been passed to the calling C code in this
case.
(I'm not really sure the NEWS entry is understandable, but I cannot
find better words)
2006-08-16 15:10:12 +00:00
Thomas Heller
b0aa98fd4f
The __repr__ method of a NULL py_object does no longer raise an
...
exception. Remove a stray '?' character from the exception text
when the value is retrieved of such an object.
Includes tests.
2006-08-16 14:07:44 +00:00
Thomas Heller
867200483b
Apply the patch #1532975 plus ideas from the patch #1533481 .
...
ctypes instances no longer have the internal and undocumented
'_as_parameter_' attribute which was used to adapt them to foreign
function calls; this mechanism is replaced by a function pointer in
the type's stgdict.
In the 'from_param' class methods, try the _as_parameter_ attribute if
other conversions are not possible.
This makes the documented _as_parameter_ mechanism work as intended.
Change the ctypes version number to 1.0.1.
2006-08-14 11:17:48 +00:00
Thomas Heller
ce049a0aef
Patch #1521817 : The index range checking on ctypes arrays containing
...
exactly one element is enabled again.
2006-07-14 17:51:14 +00:00
Thomas Heller
7644262aa5
Assigning None to pointer type structure fields possible overwrote
...
wrong fields.
2006-07-10 11:11:10 +00:00
Thomas Heller
dda068dee1
Fix bug #1518190 : accept any integer or long value in the
...
ctypes.c_void_p constructor.
2006-07-10 09:10:28 +00:00
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
2329b64c20
The test that calls a function with invalid arguments and catches the
...
resulting Windows access violation will not be run by default.
2006-07-06 08:28:14 +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
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
b3c0942356
Don't run the doctests with Python 2.3 because it doesn't have the ELLIPSIS flag.
2006-07-03 07:59:50 +00:00
Thomas Heller
c314ac5492
Next try to fix the OpenBSD buildbot tests:
...
Use ctypes.util.find_library to locate the C runtime library
on platforms where is returns useful results.
2006-06-19 08:32:46 +00:00
Thomas Heller
0b465702e6
Try to repair the failing test on the OpenBSD buildbot. Trial and error...
2006-06-19 07:07:49 +00:00
Tim Peters
4f96f1f2b5
Whitespace normalization.
2006-06-11 19:42:51 +00:00