A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-January/084998.html below:

[Python-Dev] Py_END_ALLOW_THREADS and GetLastError()

[Python-Dev] Py_END_ALLOW_THREADS and GetLastError() [Python-Dev] Py_END_ALLOW_THREADS and GetLastError()Hirokazu Yamamoto ocean-city at m2.ccsnet.ne.jp
Sat Jan 10 12:41:34 CET 2009
Kristján Valur Jónsson wrote:
 > Currently on Windows, Py_END_ALLOW_THREADS can have the side effect of
 > resetting the windows error code returned by GetLastError().
 >
 > There is a number of cases, particularly in posixmodule, with a pattern
 > like:
 >
 > Py_BEGIN_ALLOW_THREADS
 >
 >             result = FindNextFile(hFindFile, &FileData);
 >
 >             Py_END_ALLOW_THREADS
 >
 >             /* FindNextFile sets error to ERROR_NO_MORE_FILES if
 >
 >                it got to the end of the directory. */
 >
 >             if (!result && GetLastError() != ERROR_NO_MORE_FILES) {
 >
 >
 >
 > That doesn´t work.  (This particular site is where I noticed the
 > problem, running the testsuite in a debug build).
 >
 > Now, the thread swith macro does take care to preserve „errno“, but not
 > the windows system error.  This is easy to add, but it requires that
 > windows.h be included by ceval.c and pystate.c
 >
 > The alternative fix is to find all these cases and manually preserve the
 > error state, or query it right after the function call if needed.
 >
 > Any preferences?

Please see http://bugs.python.org/issue4906 :-)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4