Skip to content
Snippets Groups Projects
Commit 88118643103b authored by Stefan Behnel's avatar Stefan Behnel
Browse files

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 c1150cd51c65
Branches
No related tags found
Loading
......@@ -3,8 +3,13 @@
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')
def is_not(a, b):
"""
>>> is_not(1, 2)
True
......@@ -6,9 +11,9 @@
@cython.test_fail_if_path_exists('//NotNode')
def is_not(a, b):
"""
>>> is_not(1, 2)
True
>>> x = 1
>>> x = obj
>>> is_not(x, x)
False
"""
......@@ -20,7 +25,7 @@
"""
>>> not_is_not(1, 2)
False
>>> x = 1
>>> x = obj
>>> not_is_not(x, x)
True
"""
......@@ -32,7 +37,7 @@
"""
>>> not_is(1, 2)
True
>>> x = 1
>>> x = obj
>>> not_is(x, x)
False
"""
......
......@@ -46,6 +46,8 @@
def a(in_k, x1, x2, x3, x4, x5):
"""
>>> 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)
-67
......@@ -50,5 +52,7 @@
>>> a(10, 1, -1, -1, 1, 0)
-67
>>> sys.setrecursionlimit(old_limit)
"""
k = [in_k]
def b():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment