Skip to content

[3.12] gh-126451: Revert backports of ABC registrations for contextvars.Context and multiprocessing proxies #126735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Lib/contextvars.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 0 additions & 4 deletions Lib/multiprocessing/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import threading
import signal
import array
import collections.abc
import queue
import time
import types
Expand Down Expand Up @@ -1161,8 +1160,6 @@ def __imul__(self, value):
return self


collections.abc.MutableSequence.register(BaseListProxy)

DictProxy = MakeProxyType('DictProxy', (
'__contains__', '__delitem__', '__getitem__', '__iter__', '__len__',
'__setitem__', 'clear', 'copy', 'get', 'items',
Expand All @@ -1172,7 +1169,6 @@ def __imul__(self, value):
'__iter__': 'Iterator',
}

collections.abc.MutableMapping.register(DictProxy)

ArrayProxy = MakeProxyType('ArrayProxy', (
'__len__', '__getitem__', '__setitem__'
Expand Down
9 changes: 0 additions & 9 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import functools
import signal
import array
import collections.abc
import socket
import random
import logging
Expand Down Expand Up @@ -2460,10 +2459,6 @@ def test_list(self):
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)
Expand Down Expand Up @@ -2504,10 +2499,6 @@ def test_dict(self):
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))
Expand Down
14 changes: 0 additions & 14 deletions Lib/test/test_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import collections.abc
import concurrent.futures
import contextvars
import functools
Expand Down Expand Up @@ -343,19 +342,6 @@ def ctx2_fun():

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):
Expand Down
1 change: 0 additions & 1 deletion Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,6 @@ Emily Morehouse
Derek Morr
James A Morrison
Martin Morrison
Stephen Morton
Derek McTavish Mounce
Alessandro Moura
Pablo Mouzo
Expand Down

This file was deleted.

This file was deleted.

Loading