Commit Graph

4677 Commits

Author SHA1 Message Date
Travis E. Oliphant 0144f27602 Remove locking part of new buffer protocol. 2008-06-06 22:39:47 +00:00
Raymond Hettinger ec2fe78d47 Issue 3501: Make heapq support both __le__ and __lt__. 2008-06-06 21:47:51 +00:00
Thomas Heller f89b04c164 Performance improvement: Use PyDict_Get/SetItem instead of
PyDict_Get/SetItemString.
2008-06-06 18:37:55 +00:00
Thomas Heller fbb9c0bf3c Issue #1798: Add ctypes calling convention that allows safe access of errno.
ctypes maintains thread-local storage that has space for two error
numbers: private copies of the system 'errno' value and, on Windows,
the system error code accessed by the GetLastError() and
SetLastError() api functions.

Foreign functions created with CDLL(..., use_errno=True), when called,
swap the system 'errno' value with the private copy just before the
actual function call, and swapped again immediately afterwards.  The
'use_errno' parameter defaults to False, in this case 'ctypes_errno'
is not touched.

On Windows, foreign functions created with CDLL(...,
use_last_error=True) or WinDLL(..., use_last_error=True) swap the
system LastError value with the ctypes private copy.

The values are also swapped immeditately before and after ctypes
callback functions are called, if the callbacks are constructed using
the new optional use_errno parameter set to True: CFUNCTYPE(...,
use_errno=TRUE) or WINFUNCTYPE(..., use_errno=True).

New ctypes functions are provided to access the ctypes private copies
from Python:

- ctypes.set_errno(value) and ctypes.set_last_error(value) store
  'value' in the private copy and returns the previous value.

- ctypes.get_errno() and ctypes.get_last_error() returns the current
  ctypes private copies value.
2008-06-06 08:33:46 +00:00
Thomas Heller 2e75c450d2 Backport from py3k: Implement the new buffer interface from pep3118
for ctypes instances.  Closes issue #2404.
2008-06-05 17:51:15 +00:00
Ronald Oussoren 5640ce2f1e MacOS X: Enable 4-way universal builds
This patch adds a new configure argument on OSX:
        --with-universal-archs=[32-bit|64-bit|all]

When used with the --enable-universalsdk option this controls which
CPU architectures are includes in the framework. The default is 32-bit,
meaning i386 and ppc. The most useful alternative is 'all', which includes
all 4 CPU architectures supported by MacOS X (i386, ppc, x86_64 and ppc64).

This includes limited support for the Carbon bindings in 64-bit mode as well,
limited because (a) I haven't done extensive testing and (b) a large portion
of the Carbon API's aren't available in 64-bit mode anyway.

I've also duplicated a feature of Apple's build of python: setting the
environment variable 'ARCHFLAGS' controls the '-arch' flags used for building
extensions using distutils.
2008-06-05 12:58:24 +00:00
Thomas Heller d5bb9215c9 Revert revisions 63943 and 63942 (Issue #1798: Add ctypes calling
convention that allows safe access to errno)

This code does not yet work on OS X (__thread storage specifier not
available), so i needs a configure check plus a more portable
solution.
2008-06-04 20:22:05 +00:00
Thomas Heller 8f22b88e28 Fix ctypes.set_errno for gcc. 2008-06-04 19:19:00 +00:00
Thomas Heller e70c3378c0 Issue #1798: Add ctypes calling convention that allows safe access to
errno (and LastError, on Windows).

ctypes maintains a module-global, but thread-local, variable that
contains an error number; called 'ctypes_errno' for this discussion.
This variable is a private copy of the systems 'errno' value; the copy
is swapped with the 'errno' variable on several occasions.

Foreign functions created with CDLL(..., use_errno=True), when called,
swap the values just before the actual function call, and swapped
again immediately afterwards.  The 'use_errno' parameter defaults to
False, in this case 'ctypes_errno' is not touched.

The values are also swapped immeditately before and after ctypes
callback functions are called, if the callbacks are constructed using
the new optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE)
or WINFUNCTYPE(..., use_errno=True).

Two new ctypes functions are provided to access the 'ctypes_errno'
value from Python:

- ctypes.set_errno(value) sets ctypes_errno to 'value', the previous
  ctypes_errno value is returned.

- ctypes.get_errno() returns the current ctypes_errno value.

---

On Windows, the same scheme is implemented for the error value which
is managed by the GetLastError() and SetLastError() windows api calls.

The ctypes functions are 'ctypes.set_last_error(value)' and
'ctypes.get_last_error()', the CDLL and WinDLL optional parameter is
named 'use_last_error', defaults to False.

---

On Windows, TlsSetValue and TlsGetValue calls are used to provide
thread local storage for the variables; ctypes compiled with __GNUC__
uses __thread variables.
2008-06-04 18:59:03 +00:00
Walter Dörwald a2a89a8712 Change all functions that expect one unicode character to accept a pair of
surrogates in narrow builds. Fixes issue #1706460.
2008-06-02 20:36:03 +00:00
Thomas Heller de2d78a153 Fix misspelled sys.platform name and misspelled filename. 2008-06-02 18:41:30 +00:00
Gregory P. Smith 137d824148 Fix issue 2782: be less strict about the format string type in strftime.
Accept unicode and anything else ParseTuple "s#" can deal with.  This
matches the time.strftime behavior.
2008-06-02 04:05:52 +00:00
Martin v. Löwis 99815892f6 New environment variable PYTHONIOENCODING. 2008-06-01 07:20:46 +00:00
Gerhard Häring 7f7ca35f5b Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance. 2008-05-31 21:33:27 +00:00
Raymond Hettinger 6d7702ecd1 Implement heapq in terms of less-than (to match list.sort()). 2008-05-31 03:24:31 +00:00
Raymond Hettinger ef712d6fd3 * Mark intermedidate computes values (hi, lo, yr) as volatile.
* Expand comments.
* Swap variable names in the sum_exact code so that x and y
  are consistently chosen as the larger and smaller magnitude
  values respectively.
2008-05-30 18:20:50 +00:00
Thomas Heller 9287acf83d ctypes NULL function pointers have a boolean False value now. 2008-05-29 19:42:34 +00:00
Thomas Heller a52b244cc1 Fix compiler warning. 2008-05-29 19:18:12 +00:00
Raymond Hettinger 2a9179ac73 Fix two typos. 2008-05-29 08:38:23 +00:00
Gregory P. Smith 572226cad8 Define macros so that this still compiles on Python prior to r63675. 2008-05-26 19:03:35 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Martin v. Löwis 8c255e4173 Patch #1722225: Support QNX 6. 2008-05-23 15:06:50 +00:00
Raymond Hettinger 778d5cc4fb Tweak the comments and formatting. 2008-05-23 04:32:43 +00:00
Mark Dickinson 99dfe92759 Issue #2819: Add math.sum, a function that sums a sequence of floats
efficiently but with no intermediate loss of precision.  Based on
Raymond Hettinger's ASPN recipe.  Thanks Jean Brouwers for the patch.
2008-05-23 01:35:30 +00:00
Jesus Cea ca3939cd52 bsddb module updated to version 4.7.0 2008-05-22 15:27:38 +00:00
Thomas Heller 03b75ddf7c On HPUX, -fPIC must be used for linking. _ctypes now builds on HP-UX
IA64 and PA machines.

The ctypes unittests work fine on the IA64, but dump core in
test_qsort on the PA.
2008-05-20 19:53:47 +00:00
Georg Brandl dffbf5f542 Revert copy_reg -> copyreg rename. 2008-05-20 07:49:57 +00:00
Gregory P. Smith 664782e1c8 issue2858: Fix potential memory corruption when bsddb.db.DBEnv.lock_get
and other bsddb.db object constructors raised an exception.
Debugging & patch by Neal Norowitz.
2008-05-17 06:12:02 +00:00
Alexandre Vassalotti 3c4971c40e Added Python 3.0 warning to cPickle. 2008-05-16 19:14:31 +00:00
Georg Brandl 5049a858ba #2890: support os.O_ASYNC and fcntl.FASYNC. 2008-05-16 13:10:15 +00:00
Christian Heimes ca21c65a23 Following Amaury's advice 2008-05-16 11:28:56 +00:00
Christian Heimes 0bd23c0a98 Fixed #2870: cmathmodule.c compile error 2008-05-16 10:23:31 +00:00
Brett Cannon 2224817cdf Deprecate sunaudiodev/SUNAUDIODEV for removal in 3.0. 2008-05-16 00:10:24 +00:00
Brett Cannon 4652537ba4 Deprecate imgfile for removal in 3.0. 2008-05-15 03:32:11 +00:00
Brett Cannon 75ba465099 Deprecated 'fm' for removal in 3.0. 2008-05-15 03:23:17 +00:00
Brett Cannon 178582e2a4 FL, flp, and fl from IRIX have been deprecated for removal in 3.0. 2008-05-15 03:20:36 +00:00
Brett Cannon 044616aa24 Deprecate DEVICE, GL, gl, and the related modules cgen and cgensupport for removal in 3.0. 2008-05-15 02:33:55 +00:00
Brett Cannon 650f5161f4 Deprecate CL, CL_old, and cl for 3.0. 2008-05-14 21:12:12 +00:00
Brett Cannon ddf949f194 The CD and cd modules for IRIX are deprecated for 3.0. 2008-05-14 20:31:38 +00:00
Brett Cannon 34721d5683 Deprecate al/AL for removal in 3.0. 2008-05-14 01:08:21 +00:00
Jesus Cea ef9764f1a4 bsddb module updated to version 4.6.4 2008-05-13 18:45:46 +00:00
Brett Cannon bb141bb1f4 Deprecate the timing module for removal in Python 3.0. 2008-05-12 03:47:47 +00:00
Brett Cannon ac861b5a17 Deprecate the sv module as per PEP 4. 2008-05-12 03:45:59 +00:00
Brett Cannon 42bfa90f02 Depreate imageop for removal in 3.0. 2008-05-12 00:08:34 +00:00
Brett Cannon b61d801adb Put Lib/lib-old back on to sys.path for module renames. 2008-05-11 23:39:04 +00:00
Georg Brandl 6a57c08dc8 #1326: document and test zipimporter.archive and zipimporter.prefix. 2008-05-11 15:05:13 +00:00
Alexandre Vassalotti 9510e4a9f8 Added module stub for copy_reg renaming in 3.0.
Renamed copy_reg to copyreg in the standard library, to avoid
spurious warnings and ease later merging to py3k branch. Public
documentation remains intact.
2008-05-11 08:25:28 +00:00
Brett Cannon 7595c1a36b Flesh out the 3.0 deprecation to suggest using the ctypes module. 2008-05-11 01:09:32 +00:00
Brett Cannon df0a717037 The linuxaudidev module has been deprecated for removal in Python 3.0. 2008-05-11 00:50:51 +00:00
Brett Cannon 7f874fce63 Deprecate the dl module for removal in 3.0. 2008-05-10 21:20:19 +00:00