Thomas Heller
2e638c3a8a
Backport from py3k branch:
...
Add a workaround for a strange bug on win64, when _ctypes is compiled
with the SDK compiler. This should fix the failing
Lib\ctypes\test\test_as_parameter.py test.
2007-09-07 09:33:24 +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
Neal Norwitz
60b52bd4ed
Fix typo in docstring (missing c in reacquire)
2007-08-26 01:08:16 +00:00
Thomas Heller
fa704c6ade
Fix for SF# 1701409: segfault in c_char_p of ctypes. The repr output
...
of c_char_p and c_wchar_p has changed as a sideeffect.
2007-07-13 17:12:23 +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
b4eec28e33
Correct the name of a field in the WIN32_FIND_DATAA and WIN32_FIND_DATAW structures.
...
Closes bug #1726026 .
2007-05-30 07:01:25 +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
d059e7b423
patch #1610795 : BSD version of ctypes.util.find_library, by Martin
...
Kammerhofer.
release25-maint backport candidate, but the release manager has to
decide.
2007-01-12 20:17:34 +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
f5b5183a19
Correct the comments: the code is right.
2007-01-11 21:23:12 +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
Thomas Heller
fb9d78733e
Change the ctypes version number to "1.1.0".
2007-01-10 20:12:13 +00:00
Thomas Heller
85a2192bb6
Verify the sizes of the basic ctypes data types against the struct
...
module.
Will backport to release25-maint.
2007-01-09 19:19:33 +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
09a6f6aad2
Remove code that is no longer used (ctypes.com).
...
Fix the DllGetClassObject and DllCanUnloadNow so that they forward the
call to the comtypes.server.inprocserver module.
The latter was never documented, never used by published code, and
didn't work anyway, so I think it does not deserve a NEWS entry (but I
might be wrong).
2006-07-27 18:39:55 +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
2bdf29ec28
Fix #1521375 . When running with root priviledges, 'gcc -o /dev/null'
...
did overwrite /dev/null. Use a temporary file instead of /dev/null.
2006-07-13 17:01:14 +00:00
Thomas Heller
47d7a069d1
Fix #1467450 : ctypes now uses RTLD_GLOBAL by default on OSX 10.3 to
...
load shared libraries.
2006-07-12 08:43:47 +00:00
Thomas Heller
3b9be2ae6f
Change the ctypes version number to 1.0.0.
2006-07-11 18:40:50 +00:00
Thomas Heller
a42a662fec
When a foreign function is retrived by calling __getitem__ on a ctypes
...
library instance, do not set it as attribute.
2006-07-11 18:28:35 +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
Thomas Heller
4180e12d26
Add an __all__ list, since this module does 'from ctypes import *'.
2006-06-14 09:20:11 +00:00
Thomas Heller
866a5d89b2
Fix docstring.
2006-06-14 06:18:15 +00:00
Thomas Heller
fdbebb65af
Add back WCHAR, UINT, DOUBLE, _LARGE_INTEGER, _ULARGE_INTEGER.
...
VARIANT_BOOL is a special _ctypes data type, not c_short.
2006-06-13 09:40:14 +00:00
Thomas Heller
a7e823fd2c
Add some windows datatypes that were missing from this file, and add
...
the aliases defined in windows header files for the structures.
2006-06-13 08:56:14 +00:00