Staging
v0.5.1
https://github.com/python/cpython
Revision 9cac7b6117a61aac15c9d5ea3b85e7d3d5097a69 authored by Thomas Heller on 06 June 2008, 09:31:40 UTC, committed by Thomas Heller on 06 June 2008, 09:31:40 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r63977 | thomas.heller | 2008-06-06 10:33:46 +0200 (Fri, 06 Jun 2008) | 31 lines

  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.
........
1 parent 311c16a
History
Tip revision: 9cac7b6117a61aac15c9d5ea3b85e7d3d5097a69 authored by Thomas Heller on 06 June 2008, 09:31:40 UTC
Merged revisions 63977 via svnmerge from
Tip revision: 9cac7b6
File Mode Size
Python-ast.c -rw-r--r-- 256.9 KB
_warnings.c -rw-r--r-- 25.8 KB
asdl.c -rw-r--r-- 661 bytes
ast.c -rw-r--r-- 98.2 KB
atof.c -rw-r--r-- 815 bytes
bltinmodule.c -rw-r--r-- 55.5 KB
ceval.c -rw-r--r-- 96.2 KB
codecs.c -rw-r--r-- 20.5 KB
compile.c -rw-r--r-- 101.1 KB
dup2.c -rw-r--r-- 685 bytes
dynload_aix.c -rw-r--r-- 4.9 KB
dynload_atheos.c -rw-r--r-- 1.0 KB
dynload_dl.c -rw-r--r-- 561 bytes
dynload_hpux.c -rw-r--r-- 1.3 KB
dynload_next.c -rw-r--r-- 3.4 KB
dynload_os2.c -rw-r--r-- 1020 bytes
dynload_shlib.c -rw-r--r-- 3.2 KB
dynload_stub.c -rw-r--r-- 202 bytes
dynload_win.c -rw-r--r-- 7.5 KB
errors.c -rw-r--r-- 18.2 KB
formatter_unicode.c -rw-r--r-- 454 bytes
frozen.c -rw-r--r-- 1.3 KB
frozenmain.c -rw-r--r-- 2.2 KB
future.c -rw-r--r-- 3.4 KB
getargs.c -rw-r--r-- 42.4 KB
getcompiler.c -rw-r--r-- 366 bytes
getcopyright.c -rw-r--r-- 503 bytes
getcwd.c -rw-r--r-- 1.4 KB
getmtime.c -rw-r--r-- 388 bytes
getopt.c -rw-r--r-- 3.1 KB
getplatform.c -rw-r--r-- 130 bytes
getversion.c -rw-r--r-- 290 bytes
graminit.c -rw-r--r-- 35.9 KB
import.c -rw-r--r-- 81.6 KB
importdl.c -rw-r--r-- 2.0 KB
importdl.h -rw-r--r-- 990 bytes
marshal.c -rw-r--r-- 25.3 KB
modsupport.c -rw-r--r-- 14.7 KB
mysnprintf.c -rw-r--r-- 2.6 KB
mystrtoul.c -rw-r--r-- 6.5 KB
peephole.c -rw-r--r-- 17.5 KB
pyarena.c -rw-r--r-- 5.8 KB
pyfpe.c -rw-r--r-- 623 bytes
pymath.c -rw-r--r-- 5.3 KB
pystate.c -rw-r--r-- 17.1 KB
pystrcmp.c -rw-r--r-- 562 bytes
pystrtod.c -rw-r--r-- 13.5 KB
pythonrun.c -rw-r--r-- 49.0 KB
sigcheck.c -rw-r--r-- 529 bytes
strdup.c -rw-r--r-- 256 bytes
strtod.c -rw-r--r-- 5.1 KB
structmember.c -rw-r--r-- 6.7 KB
symtable.c -rw-r--r-- 43.0 KB
sysmodule.c -rw-r--r-- 40.4 KB
thread.c -rw-r--r-- 9.5 KB
thread_atheos.h -rw-r--r-- 6.0 KB
thread_cthread.h -rw-r--r-- 2.7 KB
thread_foobar.h -rw-r--r-- 1.9 KB
thread_lwp.h -rw-r--r-- 3.1 KB
thread_nt.h -rw-r--r-- 6.6 KB
thread_os2.h -rw-r--r-- 5.6 KB
thread_pth.h -rw-r--r-- 5.2 KB
thread_pthread.h -rw-r--r-- 12.1 KB
thread_sgi.h -rw-r--r-- 9.4 KB
thread_solaris.h -rw-r--r-- 3.0 KB
thread_wince.h -rw-r--r-- 4.0 KB
traceback.c -rw-r--r-- 7.2 KB

back to top