Skip to content

Commit a9e2576

Browse files
committed
test
1 parent b20e3d1 commit a9e2576

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎Lib/test/test_external_inspection.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from unittest.mock import ANY
1414
from test.support import (
1515
os_helper,
16+
threading_helper,
1617
SHORT_TIMEOUT,
1718
busy_retry,
1819
requires_gil_enabled,
@@ -3544,6 +3545,36 @@ def gen():
35443545
skip_non_matching_threads=True,
35453546
)
35463547

3548+
@unittest.skipIf(
3549+
sys.platform == "linux" and not PROCESS_VM_READV_SUPPORTED,
3550+
"Test only runs on Linux with process_vm_readv support",
3551+
)
3552+
@requires_gil_enabled()
3553+
@threading_helper.requires_working_threading()
3554+
def test_filtered_active_thread_is_not_replaced(self):
3555+
samples = []
3556+
3557+
def sample():
3558+
for kwargs in ({"all_threads": True},
3559+
{"only_active_thread": True}):
3560+
unwinder = RemoteUnwinder(
3561+
os.getpid(), mode=PROFILING_MODE_EXCEPTION, **kwargs,
3562+
)
3563+
samples.append(
3564+
self._get_thread_statuses(unwinder.get_stack_trace())
3565+
)
3566+
3567+
thread = threading.Thread(target=sample)
3568+
try:
3569+
raise ValueError
3570+
except ValueError:
3571+
thread.start()
3572+
threading_helper.join_thread(thread)
3573+
3574+
all_threads, active_thread = samples
3575+
self.assertEqual(list(all_threads), [threading.get_native_id()])
3576+
self.assertEqual(active_thread, {})
3577+
35473578

35483579
@requires_remote_subprocess_debugging()
35493580
class TestFrameCaching(RemoteInspectionTestBase):

0 commit comments

Comments
 (0)