• Thomas Heller's avatar
    Issue #1798: Add ctypes calling convention that allows safe access to · e70c3378
    Thomas Heller yazdı
    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.
    e70c3378
Adı
Son kayıt (commit)
Son güncelleme
..
_ctypes Loading commit data...
_sqlite Loading commit data...
cjkcodecs Loading commit data...
expat Loading commit data...
zlib Loading commit data...
Setup.config.in Loading commit data...
Setup.dist Loading commit data...
_bisectmodule.c Loading commit data...
_bsddb.c Loading commit data...
_bytesio.c Loading commit data...
_codecsmodule.c Loading commit data...
_collectionsmodule.c Loading commit data...
_csv.c Loading commit data...
_curses_panel.c Loading commit data...
_cursesmodule.c Loading commit data...
_elementtree.c Loading commit data...
_fileio.c Loading commit data...
_functoolsmodule.c Loading commit data...
_hashopenssl.c Loading commit data...
_heapqmodule.c Loading commit data...
_hotshot.c Loading commit data...
_json.c Loading commit data...
_localemodule.c Loading commit data...
_lsprof.c Loading commit data...
_randommodule.c Loading commit data...
_sre.c Loading commit data...
_ssl.c Loading commit data...
_struct.c Loading commit data...
_testcapimodule.c Loading commit data...
_tkinter.c Loading commit data...
_weakref.c Loading commit data...
addrinfo.h Loading commit data...
almodule.c Loading commit data...
ar_beos Loading commit data...
arraymodule.c Loading commit data...
audioop.c Loading commit data...
binascii.c Loading commit data...
bsddb.h Loading commit data...
bsddbmodule.c Loading commit data...
bz2module.c Loading commit data...
cPickle.c Loading commit data...
cStringIO.c Loading commit data...
cdmodule.c Loading commit data...
cgen.py Loading commit data...
cgensupport.c Loading commit data...
cgensupport.h Loading commit data...
clmodule.c Loading commit data...
cmathmodule.c Loading commit data...
config.c.in Loading commit data...
cryptmodule.c Loading commit data...
cstubs Loading commit data...
datetimemodule.c Loading commit data...
dbmmodule.c Loading commit data...
dlmodule.c Loading commit data...
errnomodule.c Loading commit data...
fcntlmodule.c Loading commit data...
flmodule.c Loading commit data...
fmmodule.c Loading commit data...
fpectlmodule.c Loading commit data...
fpetestmodule.c Loading commit data...
future_builtins.c Loading commit data...
gc_weakref.txt Loading commit data...
gcmodule.c Loading commit data...
gdbmmodule.c Loading commit data...
getaddrinfo.c Loading commit data...
getbuildinfo.c Loading commit data...
getnameinfo.c Loading commit data...
getpath.c Loading commit data...
glmodule.c Loading commit data...
grpmodule.c Loading commit data...
imageop.c Loading commit data...
imgfile.c Loading commit data...
itertoolsmodule.c Loading commit data...
ld_so_aix Loading commit data...
ld_so_beos Loading commit data...
linuxaudiodev.c Loading commit data...
main.c Loading commit data...
makesetup Loading commit data...
makexp_aix Loading commit data...
mathmodule.c Loading commit data...
md5.c Loading commit data...
md5.h Loading commit data...
md5module.c Loading commit data...
mmapmodule.c Loading commit data...
nismodule.c Loading commit data...
operator.c Loading commit data...
ossaudiodev.c Loading commit data...
parsermodule.c Loading commit data...
posixmodule.c Loading commit data...
puremodule.c Loading commit data...
pwdmodule.c Loading commit data...
pyexpat.c Loading commit data...
python.c Loading commit data...
readline.c Loading commit data...
resource.c Loading commit data...
rotatingtree.c Loading commit data...
rotatingtree.h Loading commit data...
selectmodule.c Loading commit data...
sgimodule.c Loading commit data...
sha256module.c Loading commit data...
sha512module.c Loading commit data...
shamodule.c Loading commit data...
signalmodule.c Loading commit data...
socketmodule.c Loading commit data...
socketmodule.h Loading commit data...
spwdmodule.c Loading commit data...
sre.h Loading commit data...
sre_constants.h Loading commit data...
stropmodule.c Loading commit data...
sunaudiodev.c Loading commit data...
svmodule.c Loading commit data...
symtablemodule.c Loading commit data...
syslogmodule.c Loading commit data...
termios.c Loading commit data...
testcapi_long.h Loading commit data...
threadmodule.c Loading commit data...
timemodule.c Loading commit data...
timing.h Loading commit data...
timingmodule.c Loading commit data...
tkappinit.c Loading commit data...
unicodedata.c Loading commit data...
unicodedata_db.h Loading commit data...
unicodename_db.h Loading commit data...
xxmodule.c Loading commit data...
xxsubtype.c Loading commit data...
yuv.h Loading commit data...
yuvconvert.c Loading commit data...
zipimport.c Loading commit data...
zlibmodule.c Loading commit data...