From: Eric Snow Date: Thu, 19 Oct 2023 14:52:02 +0000 (-0600) Subject: gh-76785: Make interpreters.*Channel Objects Shareable (gh-110607) X-Git-Tag: v3.13.0a2~404 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d23a2f988771f4abd771ab4274529dcbf60dae37;p=thirdparty%2FPython%2Fcpython.git gh-76785: Make interpreters.*Channel Objects Shareable (gh-110607) This restores their shareability, which was disabled by gh-110318 due to ref leaks. --- diff --git a/Lib/test/support/interpreters.py b/Lib/test/support/interpreters.py index 860b2bb927f6..182f47b19f1d 100644 --- a/Lib/test/support/interpreters.py +++ b/Lib/test/support/interpreters.py @@ -264,4 +264,4 @@ class SendChannel(_ChannelEnd): # XXX This is causing leaks (gh-110318): -#_channels._register_end_types(SendChannel, RecvChannel) +_channels._register_end_types(SendChannel, RecvChannel) diff --git a/Lib/test/test_interpreters.py b/Lib/test/test_interpreters.py index 63d41cb264d9..e124a7cc7259 100644 --- a/Lib/test/test_interpreters.py +++ b/Lib/test/test_interpreters.py @@ -833,7 +833,6 @@ class TestChannels(TestBase): after = set(interpreters.list_all_channels()) self.assertEqual(after, created) - @unittest.expectedFailure # See gh-110318: def test_shareable(self): rch, sch = interpreters.create_channel() diff --git a/Modules/_xxinterpchannelsmodule.c b/Modules/_xxinterpchannelsmodule.c index 8dd8050752a7..11fe8cd01fc4 100644 --- a/Modules/_xxinterpchannelsmodule.c +++ b/Modules/_xxinterpchannelsmodule.c @@ -441,6 +441,10 @@ _get_current_module_state(void) static int traverse_module_state(module_state *state, visitproc visit, void *arg) { + /* external types */ + Py_VISIT(state->send_channel_type); + Py_VISIT(state->recv_channel_type); + /* heap types */ Py_VISIT(state->ChannelInfoType); Py_VISIT(state->ChannelIDType);