Commit Graph

39842 Commits

Author SHA1 Message Date
Georg Brandl d82a9c1618 Fix brackets. 2008-06-06 10:43:43 +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
Georg Brandl d77554fe8c Markup fix. 2008-06-06 07:34:50 +00:00
Neal Norwitz 2a3e3d0446 Aldo Cortesi confirmed this is still needed for OpenBSD 4.2 and 4.3.
(I didn't regen configure, since I don't have a working autoconf.)
2008-06-06 04:47:01 +00:00
Andrew M. Kuchling 5e3e6ba81d Grammar fix 2008-06-05 23:35:48 +00:00
Andrew M. Kuchling b5a40dd224 Add various items 2008-06-05 23:35:31 +00:00
Andrew M. Kuchling 6dd8ccab2c Document 'utc' parameter 2008-06-05 23:33:54 +00:00
Benjamin Peterson 8456f64ce2 revert 63965 for preformance reasons 2008-06-05 23:02:33 +00:00
Benjamin Peterson 30dc7b8ce2 use the more idomatic while True 2008-06-05 22:39:34 +00:00
Thomas Heller 59475e9739 Backport from py3k: Implement the new buffer interface from pep3118
for ctypes instances.  Closes issue #2404.
2008-06-05 17:52:59 +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
Thomas Heller 259a566ac5 Fix preprocessor statement. 2008-06-05 17:29:38 +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
Alexandre Vassalotti 80af6da748 Fixed complex.__getnewargs__() to not emit another complex object. 2008-06-04 20:41:44 +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
Georg Brandl a2b34b87a9 Complete revision of new turtle module's docs. 2008-06-04 11:17:26 +00:00
Martin v. Löwis 8718459f0f Patch #1513695: New turtle module, with demos. 2008-06-04 06:29:55 +00:00
Georg Brandl 4ed3ed13c5 Fix Tkinter sequence passing. #2906. 2008-06-03 10:23:15 +00:00
Benjamin Peterson c5393c64b8 make test_mutex more elegant 2008-06-03 01:30:37 +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 261b136321 Fix the -x flag so that is does work. 2008-06-02 20:07:46 +00:00
Thomas Heller de2d78a153 Fix misspelled sys.platform name and misspelled filename. 2008-06-02 18:41:30 +00:00
Martin v. Löwis ffe62ed46d Patch #2125: Add GetInteger and GetString methods for
msilib.Record objects.
2008-06-02 08:40:06 +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
Gregory P. Smith 8856ddae25 Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object.  feature request issue 2871.
2008-06-01 23:48:47 +00:00
Gregory P. Smith 1bd52d745b Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
2008-06-01 22:57:47 +00:00
Georg Brandl ac19d85e04 Deprecate htmllib and sgmllib for 3.0. 2008-06-01 21:19:14 +00:00
Georg Brandl 681001e11b Generate pydoc's topic help from the reST docs via Sphinx'
new text writer.
2008-06-01 20:33:55 +00:00
Georg Brandl 0b9aaa98a0 Spaces vs. tabs. 2008-06-01 19:24:36 +00:00
Benjamin Peterson c49372b080 add a warning about bgen being removed 2008-06-01 19:01:25 +00:00
Robert Schuppenies 9359afff56 Fix test_sys. 2008-06-01 17:11:09 +00:00
Georg Brandl 12f8107f91 Fix test_descrtut. 2008-06-01 17:05:56 +00:00
Georg Brandl 7a6de8b0f4 Some style nits. Also clarify in the docstrings what __sizeof__ does. 2008-06-01 16:42:16 +00:00
Georg Brandl 4f2c998ca9 Add plain text make target. 2008-06-01 16:41:31 +00:00
Robert Schuppenies 51df064767 Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. 2008-06-01 16:16:17 +00:00
Martin v. Löwis 6495c8da8f Typo: encoding -> codeset. 2008-06-01 08:19:02 +00:00
Martin v. Löwis b12d8579e3 Move sys_stream and sys_isatty out of the have-langinfo block. 2008-06-01 08:06:17 +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
Georg Brandl 8bfba67101 #3005: add explaining sentence to easydialogs docs. 2008-05-31 14:45:55 +00:00
Georg Brandl a7ac20f8a5 #3010: clarification about stdin/use_rawinput. 2008-05-31 14:40:09 +00:00
Mark Summerfield 700a635091 Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
2008-05-31 13:05:34 +00:00
Mark Hammond 5bd88333ee Fix bdist_wininst --user-access-control for win2k 2008-05-31 05:11:07 +00:00
Raymond Hettinger 6d7702ecd1 Implement heapq in terms of less-than (to match list.sort()). 2008-05-31 03:24:31 +00:00
Marc-André Lemburg adff65bc3e Update the locale module alias table.
Closes #3011.
2008-05-30 20:52:18 +00:00
Benjamin Peterson 31694ae4a5 fix grammar 2008-05-30 20:44:39 +00:00
Georg Brandl c5a235bb55 Better quote with single quotes. 2008-05-30 19:17:29 +00:00
Georg Brandl 6bb7bcf5f7 getloadavg() is not available on Windows. 2008-05-30 19:12:13 +00:00