Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e41677b

Browse files
authored
gh-157415: Skip @support.nomemtest if Python is built with TSAN (#157416)
There is a known data race involving PyMem_SetAllocator(). Just skip tests using _testcapi.set_nomemory() is Python is built with the thread sanitizer. Mark test_io.test_memoryio test using _testcapi.set_nomemory() with @support.nomemtest.
1 parent a2f4f19 commit e41677b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/test/support/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,11 @@ def internal(*args, **kwargs):
13731373
import_module('_testcapi')
13741374
return test(*args, **kwargs)
13751375

1376-
return cpython_only(internal)
1376+
use_tsan = check_sanitizer(thread=True)
1377+
reason ='not working with thread sanitizer (gh-157415)'
1378+
skip_if_tsan = unittest.skipIf(use_tsan, reason)
1379+
1380+
return cpython_only(skip_if_tsan(internal))
13771381

13781382
def bigaddrspacetest(f):
13791383
"""Decorator for tests that fill the address space."""

Lib/test/test_io/test_memoryio.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ def __buffer__(self, flags):
754754
self.assertEqual(memio.getvalue(), b"01AAA56789")
755755
self.assertEqual(memio.tell(), 5)
756756

757+
@support.nomemtest
757758
def test_memory_error(self):
758759
# gh-157242: io.BytesIO() must not close the file on MemoryError
759760
_testcapi = import_helper.import_module('_testcapi')

0 commit comments

Comments
 (0)