]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-126451: Revert backports of ABC registrations for contextvars.Context and...
authorAlex Waygood <Alex.Waygood@Gmail.com>
Tue, 12 Nov 2024 12:26:23 +0000 (12:26 +0000)
committerGitHub <noreply@github.com>
Tue, 12 Nov 2024 12:26:23 +0000 (12:26 +0000)
Lib/contextvars.py
Lib/multiprocessing/managers.py
Lib/test/_test_multiprocessing.py
Lib/test/test_context.py
Misc/ACKS
Misc/NEWS.d/next/Library/2024-11-04-16-40-02.gh-issue-126417.OWPqn0.rst [deleted file]
Misc/NEWS.d/next/Library/2024-11-05-11-28-45.gh-issue-126451.XJMtqz.rst [deleted file]

index 14514f185e069dd60ec521f7f5a579c10f1d802c..d78c80dfe6f99cefe1a875b16a9e7296546636fe 100644 (file)
@@ -1,8 +1,4 @@
-import _collections_abc
 from _contextvars import Context, ContextVar, Token, copy_context
 
 
 __all__ = ('Context', 'ContextVar', 'Token', 'copy_context')
-
-
-_collections_abc.Mapping.register(Context)
index b915e67c265b3d8ff7629eb9f39063dbf7ee0a52..75d9c18c201a86da3b3c2eaede426dace711c701 100644 (file)
@@ -18,7 +18,6 @@ import sys
 import threading
 import signal
 import array
-import collections.abc
 import queue
 import time
 import types
@@ -1161,8 +1160,6 @@ class ListProxy(BaseListProxy):
         return self
 
 
-collections.abc.MutableSequence.register(BaseListProxy)
-
 DictProxy = MakeProxyType('DictProxy', (
     '__contains__', '__delitem__', '__getitem__', '__iter__', '__len__',
     '__setitem__', 'clear', 'copy', 'get', 'items',
@@ -1172,7 +1169,6 @@ DictProxy._method_to_typeid_ = {
     '__iter__': 'Iterator',
     }
 
-collections.abc.MutableMapping.register(DictProxy)
 
 ArrayProxy = MakeProxyType('ArrayProxy', (
     '__len__', '__getitem__', '__setitem__'
index c190dc918dac64637d16347a0c4eebced5a63b5e..3b4415b50ae2c273c3e7d82c8125cb1c6f4d82ef 100644 (file)
@@ -17,7 +17,6 @@ import errno
 import functools
 import signal
 import array
-import collections.abc
 import socket
 import random
 import logging
@@ -2460,10 +2459,6 @@ class _TestContainers(BaseTestCase):
         a.append('hello')
         self.assertEqual(f[0][:], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'hello'])
 
-    def test_list_isinstance(self):
-        a = self.list()
-        self.assertIsInstance(a, collections.abc.MutableSequence)
-
     def test_list_iter(self):
         a = self.list(list(range(10)))
         it = iter(a)
@@ -2504,10 +2499,6 @@ class _TestContainers(BaseTestCase):
         self.assertEqual(sorted(d.values()), [chr(i) for i in indices])
         self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices])
 
-    def test_dict_isinstance(self):
-        a = self.dict()
-        self.assertIsInstance(a, collections.abc.MutableMapping)
-
     def test_dict_iter(self):
         d = self.dict()
         indices = list(range(65, 70))
index d9e1c6214e7057bbc19a3814e54659ea31345f9b..dc6856509a40a01a85ec628bba165f545119499e 100644 (file)
@@ -1,4 +1,3 @@
-import collections.abc
 import concurrent.futures
 import contextvars
 import functools
@@ -343,19 +342,6 @@ class ContextTest(unittest.TestCase):
 
         ctx1.run(ctx1_fun)
 
-    def test_context_isinstance(self):
-        ctx = contextvars.Context()
-        self.assertIsInstance(ctx, collections.abc.Mapping)
-        self.assertTrue(issubclass(contextvars.Context, collections.abc.Mapping))
-
-        mapping_methods = (
-            '__contains__', '__eq__', '__getitem__', '__iter__', '__len__',
-            '__ne__', 'get', 'items', 'keys', 'values',
-        )
-        for name in mapping_methods:
-            with self.subTest(name=name):
-                self.assertTrue(callable(getattr(ctx, name)))
-
     @isolated_context
     @threading_helper.requires_working_threading()
     def test_context_threads_1(self):
index b5cf6acc55a88ce288859d42f36ca44c722c486d..837ffbda18aea1012e855286bf7f695a6804ece4 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1259,7 +1259,6 @@ Emily Morehouse
 Derek Morr
 James A Morrison
 Martin Morrison
-Stephen Morton
 Derek McTavish Mounce
 Alessandro Moura
 Pablo Mouzo
diff --git a/Misc/NEWS.d/next/Library/2024-11-04-16-40-02.gh-issue-126417.OWPqn0.rst b/Misc/NEWS.d/next/Library/2024-11-04-16-40-02.gh-issue-126417.OWPqn0.rst
deleted file mode 100644 (file)
index c4a3663..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Register the :class:`!multiprocessing.managers.DictProxy` and :class:`!multiprocessing.managers.ListProxy` types in
-:mod:`multiprocessing.managers` to :class:`collections.abc.MutableMapping` and
-:class:`collections.abc.MutableSequence`, respectively.
diff --git a/Misc/NEWS.d/next/Library/2024-11-05-11-28-45.gh-issue-126451.XJMtqz.rst b/Misc/NEWS.d/next/Library/2024-11-05-11-28-45.gh-issue-126451.XJMtqz.rst
deleted file mode 100644 (file)
index 563cb25..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Register the :class:`contextvars.Context` type to
-:class:`collections.abc.Mapping`.