Skip to content

Commit

Permalink
Partially disable trashcan test in PyPy (#5832)
Browse files Browse the repository at this point in the history
The test is requiring a derministic order of destruction which
PyPy doesn't give reliably and thus we're getting occasional CI
failures. Therefore just treat is as compile and don't crash
test.
  • Loading branch information
da-woods committed Nov 19, 2023
1 parent e0d2a36 commit 30c37a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/run/trashcan.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

cimport cython

import sys

# The tests here are to do with a deterministic order of destructors which
# isn't reliable for PyPy. Therefore, on PyPy we treat the test as
# "compiles and doesn't crash"
IS_PYPY = hasattr(sys, 'pypy_version_info')

# Count number of times an object was deallocated twice. This should remain 0.
cdef int double_deallocations = 0
def assert_no_double_deallocations():
if IS_PYPY:
return
global double_deallocations
err = double_deallocations
double_deallocations = 0
Expand Down Expand Up @@ -98,6 +106,8 @@ cdef class RecurseList(list):
cdef int base_deallocated = 0
cdef int trashcan_used = 0
def assert_no_trashcan_used():
if IS_PYPY:
return
global base_deallocated, trashcan_used
err = trashcan_used
trashcan_used = base_deallocated = 0
Expand Down

0 comments on commit 30c37a6

Please sign in to comment.