]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-76785: Make interpreters.*Channel Objects Shareable (gh-110607)
authorEric Snow <ericsnowcurrently@gmail.com>
Thu, 19 Oct 2023 14:52:02 +0000 (08:52 -0600)
committerGitHub <noreply@github.com>
Thu, 19 Oct 2023 14:52:02 +0000 (08:52 -0600)
This restores their shareability, which was disabled by gh-110318 due to ref leaks.

Lib/test/support/interpreters.py
Lib/test/test_interpreters.py
Modules/_xxinterpchannelsmodule.c

index 860b2bb927f61cf2fc313714d1b97ffbcc09d86e..182f47b19f1dd4f9ad01f9218eb843a1d938d59e 100644 (file)
@@ -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)
index 63d41cb264d96628c28ce8326d03903e0b9a08c1..e124a7cc7259a290db3ab4eeac4a415bba2286da 100644 (file)
@@ -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()
 
index 8dd8050752a717789a0b7ce00661db53fc4be11a..11fe8cd01fc47b459de641ac599d7e85bdb968a3 100644 (file)
@@ -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);