Skip to content

Commit 83b92ce

Browse files
authored
Try to fix reentrant write transient failures in tests (#5447)
* Disable print_destroyed in tests on GraalPy * Reenable test_iostream on GraalPy
1 parent 330aae5 commit 83b92ce

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/constructor_stats.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,16 @@ void print_created(T *inst, Values &&...values) {
312312
}
313313
template <class T, typename... Values>
314314
void print_destroyed(T *inst, Values &&...values) { // Prints but doesn't store given values
315+
/*
316+
* On GraalPy, destructors can trigger anywhere and this can cause random
317+
* failures in unrelated tests.
318+
*/
319+
#if !defined(GRAALVM_PYTHON)
315320
print_constr_details(inst, "destroyed", values...);
316321
track_destroyed(inst);
322+
#else
323+
py::detail::silence_unused_warnings(inst, values...);
324+
#endif
317325
}
318326
template <class T, typename... Values>
319327
void print_values(T *inst, Values &&...values) {

tests/test_iostream.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@
66

77
import pytest
88

9-
import env # noqa: F401
109
from pybind11_tests import iostream as m
1110

12-
pytestmark = pytest.mark.skipif(
13-
"env.GRAALPY",
14-
reason="Delayed prints from finalizers from other tests can end up in the output",
15-
)
16-
1711

1812
def test_captured(capsys):
1913
msg = "I've been redirected to Python, I hope!"

0 commit comments

Comments
 (0)