Commit f055a66c authored by Stefan Behnel's avatar Stefan Behnel

Try to work around some test issues in PyPy3:

- CyFunction seems to lead to deeper stacks on recursion.
- Passing integers through call layers can end up creating new int objects instead of keeping the identical objects ('is' test fails)'.
parent ff2dfa0b
...@@ -3,12 +3,17 @@ ...@@ -3,12 +3,17 @@
cimport cython cimport cython
# Use a single global object for identity checks.
# PyPy can optimise away integer objects, for example, and may fail the 'is' test.
obj = object()
@cython.test_fail_if_path_exists('//NotNode') @cython.test_fail_if_path_exists('//NotNode')
def is_not(a, b): def is_not(a, b):
""" """
>>> is_not(1, 2) >>> is_not(1, 2)
True True
>>> x = 1 >>> x = obj
>>> is_not(x, x) >>> is_not(x, x)
False False
""" """
...@@ -20,7 +25,7 @@ def not_is_not(a, b): ...@@ -20,7 +25,7 @@ def not_is_not(a, b):
""" """
>>> not_is_not(1, 2) >>> not_is_not(1, 2)
False False
>>> x = 1 >>> x = obj
>>> not_is_not(x, x) >>> not_is_not(x, x)
True True
""" """
...@@ -32,7 +37,7 @@ def not_is(a, b): ...@@ -32,7 +37,7 @@ def not_is(a, b):
""" """
>>> not_is(1, 2) >>> not_is(1, 2)
True True
>>> x = 1 >>> x = obj
>>> not_is(x, x) >>> not_is(x, x)
False False
""" """
......
...@@ -46,9 +46,13 @@ def compute(val): ...@@ -46,9 +46,13 @@ def compute(val):
def a(in_k, x1, x2, x3, x4, x5): def a(in_k, x1, x2, x3, x4, x5):
""" """
>>> import sys >>> import sys
>>> sys.setrecursionlimit(1350) >>> old_limit = sys.getrecursionlimit()
>>> sys.setrecursionlimit(1350 if not getattr(sys, 'pypy_version_info', None) else 2700)
>>> a(10, 1, -1, -1, 1, 0) >>> a(10, 1, -1, -1, 1, 0)
-67 -67
>>> sys.setrecursionlimit(old_limit)
""" """
k = [in_k] k = [in_k]
def b(): def b():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment