[pypy-commit] pypy default: Fix on Windows: now one of these functions called by

arigo noreply at buildbot.pypy.org
Mon Dec 22 21:37:44 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r75068:246cc6f071ab
Date: 2014-12-22 21:37 +0100
http://bitbucket.org/pypy/pypy/changeset/246cc6f071ab/

Log:	Fix on Windows: now one of these functions called by
	after_external_call() modifies GetLastError too, so we need to save
	and restore it as well.

diff --git a/pypy/module/thread/gil.py b/pypy/module/thread/gil.py
--- a/pypy/module/thread/gil.py
+++ b/pypy/module/thread/gil.py
@@ -7,7 +7,7 @@
 # all but one will be blocked.  The other threads get a chance to run
 # from time to time, using the periodic action GILReleaseAction.
 
-from rpython.rlib import rthread, rgil
+from rpython.rlib import rthread, rgil, rwin32
 from pypy.module.thread.error import wrap_thread_error
 from pypy.interpreter.executioncontext import PeriodicAsyncAction
 from pypy.module.thread.threadlocals import OSThreadLocals
@@ -76,9 +76,14 @@
 
 def after_external_call():
     e = get_errno()
+    e2 = 0
+    if rwin32.WIN32:
+        e2 = rwin32.GetLastError()
     rgil.gil_acquire()
     rthread.gc_thread_run()
     after_thread_switch()
+    if rwin32.WIN32:
+        rwin32.SetLastError(e2)
     set_errno(e)
 after_external_call._gctransformer_hint_cannot_collect_ = True
 after_external_call._dont_reach_me_in_del_ = True


More information about the pypy-commit mailing list