Fix Pyston speedups (#281)

We remove (i.e. hide behind a debug ifdef) the recursion checking methods,
and the memory hooks and memory allocator methods. ASAN mode has no
PYMALLOC, so we need a macro. Fix build break with des.c stack allocation.
This commit is contained in:
Gautham 2021-10-02 13:58:51 +05:30 committed by GitHub
parent 2fe8571010
commit 57f0eed382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 260 additions and 63 deletions

View file

@ -1,5 +1,6 @@
"""Unit tests for the copy module."""
import cosmo
import copy
import copyreg
import weakref
@ -372,8 +373,9 @@ class TestCopy(unittest.TestCase):
x = []
x.append(x)
y = copy.deepcopy(x)
for op in comparisons:
self.assertRaises(RecursionError, op, y, x)
if cosmo.MODE == "dbg": # requires recursion checking
for op in comparisons:
self.assertRaises(RecursionError, op, y, x)
self.assertIsNot(y, x)
self.assertIs(y[0], y)
self.assertEqual(len(y), 1)
@ -399,8 +401,9 @@ class TestCopy(unittest.TestCase):
x = ([],)
x[0].append(x)
y = copy.deepcopy(x)
for op in comparisons:
self.assertRaises(RecursionError, op, y, x)
if cosmo.MODE == "dbg": # requires recursion checking
for op in comparisons:
self.assertRaises(RecursionError, op, y, x)
self.assertIsNot(y, x)
self.assertIsNot(y[0], x[0])
self.assertIs(y[0][0], y)
@ -418,8 +421,9 @@ class TestCopy(unittest.TestCase):
y = copy.deepcopy(x)
for op in order_comparisons:
self.assertRaises(TypeError, op, y, x)
for op in equality_comparisons:
self.assertRaises(RecursionError, op, y, x)
if cosmo.MODE == "dbg": # requires recursion checking
for op in equality_comparisons:
self.assertRaises(RecursionError, op, y, x)
self.assertIsNot(y, x)
self.assertIs(y['foo'], y)
self.assertEqual(len(y), 1)