This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author theller
Recipients theller
Date 2008-01-11.20:51:35
SpamBayes Score 0.007953968
Marked as misclassified No
Message-id <>
This patch adds new calling conventions to ctypes foreign functions by
passing 'errno=True' or 'GetLastError=True' to the CDLL or WinDLL

If CDLL(..., errno=True) or WinDLL(..., errno=True) is used, the
function objects available in the CDLL or WinDLL instance will set the C
global errno to zero before the actual call, and attach the C global
errno value after the call as 'errno' attribute to the function object.
 This attribute is stored in thread-local storage.

Similarly, if CDLL(..., GetLastError=True) or WinDLL(...,
GetLastError=True) is used, the win32 api function 'SetLastError(0)' is
used to reset the windows last error code before the actual call, and
the value returned by 'GetLastError()' is attached as 'LastError'
attribute to the function object, in thread local storage.  Of course
this only occurs on Windows.

The LastError and errno attributes are readonly from Python code,
accessing them before a foreign function call has occurred in the
current thread raises a ValueError.
Date User Action Args
2008-01-11 20:51:37thellersetspambayes_score: 0.00795397 -> 0.007953968
recipients: + theller
2008-01-11 20:51:37thellersetspambayes_score: 0.00795397 -> 0.00795397
messageid: <>
2008-01-11 20:51:36thellerlinkissue1798 messages
2008-01-11 20:51:36thellercreate