Commit graph

56 commits

Author SHA1 Message Date
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
Thomas Heller
c2da994585 Add pep-291 compatibility markers. 2006-06-12 20:56:48 +00:00
Tim Peters
4f96f1f2b5 Whitespace normalization. 2006-06-11 19:42:51 +00:00
Neal Norwitz
6aaccc6b55 Fix errors found by pychecker 2006-06-11 08:35:14 +00:00
Thomas Heller
5114826950 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:55:36 +00:00
Thomas Heller
56dab85022 Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures 2006-06-06 15:34:18 +00:00
Martin Blais
215f13dd11 Normalized a few cases of whitespace in function declarations.
Found them using::

  find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done
  find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done

(I was doing this all over my own code anyway, because I'd been using spaces in
all defs, so I thought I'd make a run on the Python code as well.  If you need
to do such fixes in your own code, you can use xx-rename or parenregu.el within
emacs.)
2006-06-06 12:46:55 +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
Richard Jones
7b9558d37d Conversion of exceptions over from faked-up classes to new-style C types. 2006-05-27 12:29:24 +00:00
Thomas Heller
0e10cb0266 add svn:eol-style native svn:keywords Id 2006-05-12 19:31:46 +00:00
Thomas Heller
e43a0fcc9d Add missing svn properties. 2006-05-12 18:16:03 +00:00
Thomas Heller
40f55b2f08 Disable a test that is unreliable. 2006-05-09 20:20:15 +00:00
Thomas Heller
97a7b7fef3 oops - the function is exported as 'my_free', not 'free'. 2006-05-05 18:46:27 +00:00
Thomas Heller
748f6fbf2c Fix memory leaks in the ctypes test suite, reported by valgrind, by
free()ing the memory we allocate.
2006-05-05 18:43:24 +00:00
Thomas Heller
14f3da7585 Don't fail the tests when libglut.so or libgle.so cannot be loaded. 2006-05-03 18:35:39 +00:00
Thomas Heller
6a907d8b8e Remove a duplicated test (the same test is in test_incomplete.py). 2006-04-28 17:02:18 +00:00
Thomas Heller
6ff67ef096 Merge in changes from ctypes 0.9.9.6 upstream version. 2006-04-21 16:51:04 +00:00
Tim Peters
c5c9ce957d Add missing SVN eol-style property to text files. 2006-04-16 22:11:28 +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
Tim Peters
319c47fcdb Try to repair what may be the last new test failure on the
"x86 OpenBSD trunk" buildbot due to changing Python so that
Python-exposed addresses are always non-negative.

test_int_pointer_arg():  This line failed now whenever the
box happened to assign an address to `ci` "with the sign
bit set":

    self.failUnlessEqual(addressof(ci), func(byref(ci)))

The problem is that the ctypes addressof() inherited "all
addresses are non-negative now" from changes to
PyLong_FromVoidPtr(), but byref() did not inherit that
change and can still return a negative int.

I don't know whether, or what, the ctypes implementation wants
to do about that (possibly nothing), but in the meantime
the test fails frequently.

So, introduced a Python positive_address() function in
the test module, that takes a purported machine address and,
if negative, converts it to a non-negative value "with the
same bits".  This should leave the test passing under all
versions of Python.

Belated thanks to Armin Rigo for teaching me the sick trick ;-)
for determining the # of bits in a machine pointer via abuse
of the struct module.
2006-04-11 02:59:48 +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
fb8f83b33f One test still fails on the ia64 debian box. 2006-04-05 19:01:35 +00:00
Thomas Heller
726dcf34a6 Use 'ldd' to find the libc library to load. Based on an idea from Matthias Klose. 2006-04-05 17:36:45 +00:00
Neal Norwitz
b0b20a10bc Get ctypes loader working on OSF1 (Tru64) 2006-04-03 06:52:43 +00:00
Thomas Heller
0d93a23479 Try to fix test_loading on openbsd. 2006-03-30 19:16:15 +00:00
Thomas Heller
300269ae6f Oops - this should not have gone in. 2006-03-30 18:29:25 +00:00
Thomas Heller
b320682577 Output more info when the test fails. 2006-03-30 17:49:55 +00:00
Thomas Heller
240ec6b9ef Make the tests succeed with -Qnew: Do not rely on the exact wording of a ZeroDivisionError. 2006-03-28 11:00:08 +00:00
Thomas Heller
cce2267cf1 Plug a leak in the ctypes test suite when tests are run repeatedly. 2006-03-20 08:11:56 +00:00
Thomas Heller
d59ca8f335 Accessing unaligned structure fields works now on all architectures.
Including unittest.
2006-03-20 07:54:01 +00:00
Thomas Heller
b03cb602e8 Merge changes from the upstream version:
- cast is implemented as a foreign function now
- On Windows, it is now possible to access functions exported by ordinal only
2006-03-17 15:52:58 +00:00
Thomas Heller
23e408603c Fix a test that fails when libGL.so and libGLU.so are not installed (on posix systems). 2006-03-16 20:09:22 +00:00
Thomas Heller
a022789ab3 Plug some refcount leaks when tests are run repeatedly. 2006-03-13 10:47:02 +00:00