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 skrah
Recipients boytsovea, skrah, vstinner, yselivanov
Date 2020-03-03.15:21:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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


def usleep(x):

class Test:

    def __init__(self, threadno):
        self.threadno = threadno

    def GetCallback(self):
        usleep(randint(0, 9));
        usleep(randint(0, 9))
        c = getcontext()
            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()
            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.
Date User Action Args
2020-03-03 15:21:52skrahsetrecipients: + skrah, vstinner, yselivanov, boytsovea
2020-03-03 15:21:52skrahsetmessageid: <>
2020-03-03 15:21:52skrahlinkissue39776 messages
2020-03-03 15:21:51skrahcreate