Stefan Krah <ste...@bytereef.org> added the comment:
Also _pydecimal was affected. This is a modified version of Evgeny's test case: from _pydecimal import * from time import sleep from random import randint import sys sys.setswitchinterval(0.0000001) def usleep(x): sleep(x/1000000.0) class Test: def __init__(self, threadno): self.threadno = threadno def GetCallback(self): usleep(randint(0, 9)); setcontext(Context(Emax=self.threadno)) usleep(randint(0, 9)) c = getcontext() try: if c.Emax != self.threadno: raise RuntimeError("GetCallback: another thread changed this thread's context") except AttributeError: raise RuntimeError("GetCallback: type(c)==%s and c.Emax disappeared" % type(c)) usleep(randint(0, 9)) return self.Callback def Callback(self): c = getcontext() try: c.Emax = self.threadno except AttributeError: raise RuntimeError("Callback: type(c)==%s and c.Emax disappeared" % type(c)) def DoTest(threadno): return Test(threadno).GetCallback() It produces one of the exceptions or a segfault. You may have to build in release mode to get the race. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39776> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com