summaryrefslogtreecommitdiffstats
path: root/Lib/collections/__init__.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-06-05 15:22:31 (GMT)
committerGitHub <noreply@github.com>2019-06-05 15:22:31 (GMT)
commit142566c028720934325f0b7fe28680afd046e00f (patch)
tree021875972731bf9271bf07cc05d17f15866ded7a /Lib/collections/__init__.py
parent6c01ebcc0dfc6be22950fabb46bdc10dcb6202c9 (diff)
downloadcpython-142566c028720934325f0b7fe28680afd046e00f.zip
cpython-142566c028720934325f0b7fe28680afd046e00f.tar.gz
cpython-142566c028720934325f0b7fe28680afd046e00f.tar.bz2
[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
Turn deprecation warnings added in 3.8 into TypeError.
Diffstat (limited to 'Lib/collections/__init__.py')
-rw-r--r--Lib/collections/__init__.py18
1 files changed, 1 insertions, 17 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index e9999e2..2264efe 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -971,28 +971,12 @@ class ChainMap(_collections_abc.MutableMapping):
class UserDict(_collections_abc.MutableMapping):
# Start by filling-out the abstract methods
- def __init__(*args, **kwargs):
- if not args:
- raise TypeError("descriptor '__init__' of 'UserDict' object "
- "needs an argument")
- self, *args = args
- if len(args) > 1:
- raise TypeError('expected at most 1 arguments, got %d' % len(args))
- if args:
- dict = args[0]
- elif 'dict' in kwargs:
- dict = kwargs.pop('dict')
- import warnings
- warnings.warn("Passing 'dict' as keyword argument is deprecated",
- DeprecationWarning, stacklevel=2)
- else:
- dict = None
+ def __init__(self, dict=None, /, **kwargs):
self.data = {}
if dict is not None:
self.update(dict)
if kwargs:
self.update(kwargs)
- __init__.__text_signature__ = '($self, dict=None, /, **kwargs)'
def __len__(self): return len(self.data)
def __getitem__(self, key):