PyPy2 and PyPy3 segfaulting when running a simple Python program
This basic Python program will segfault when run in either PyPy2 or PyPy3.
def gcd(x, y): while y: x, y = y, x % y return x def main(): n = 50 a = list(range(1, n + 1))[::-1] f =  * n f = 1 g = a for i in range(n): mx = 0 pos = -1 for i in range(n): if f[i] == 0: if gcd(g, a[i]) > mx: mx = gcd(g, a[i]) pos = i g = gcd(g, a[pos]) main()
I've tested this locally on my Windows computers (running PyPy2 and PyPy3 7.3.1) and I've also had multiple friends try running it on their systems. It segfaults for everyone.
Worth noting is that adding the line
pypyjit.set_param(threshold = 2) at the top will make it segfault for n = 3. So the segfault seems to be connected to the JIT.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information