summaryrefslogtreecommitdiffstats
path: root/Lib/plistlib.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-05-08 14:10:11 (GMT)
committerGitHub <noreply@github.com>2022-05-08 14:10:11 (GMT)
commit3680ebed7f3e529d01996dd0318601f9f0d02b4b (patch)
tree7889885b7ce3089f5ce5d02d88e7a55518644aae /Lib/plistlib.py
parentc826867b7c1bb69639290d8df0f850ec3f9a6c72 (diff)
downloadcpython-3680ebed7f3e529d01996dd0318601f9f0d02b4b.zip
cpython-3680ebed7f3e529d01996dd0318601f9f0d02b4b.tar.gz
cpython-3680ebed7f3e529d01996dd0318601f9f0d02b4b.tar.bz2
bpo-44712: Replace "type(literal)" with corresponding builtin types (GH-27294)
I suppose it is a remnants of very old code written when str, int, list, dict, etc were functions and not classes.
Diffstat (limited to 'Lib/plistlib.py')
-rw-r--r--Lib/plistlib.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/plistlib.py b/Lib/plistlib.py
index 4862355..d03c75d 100644
--- a/Lib/plistlib.py
+++ b/Lib/plistlib.py
@@ -199,7 +199,7 @@ class _PlistParser:
def add_object(self, value):
if self.current_key is not None:
- if not isinstance(self.stack[-1], type({})):
+ if not isinstance(self.stack[-1], dict):
raise ValueError("unexpected element at line %d" %
self.parser.CurrentLineNumber)
self.stack[-1][self.current_key] = value
@@ -208,7 +208,7 @@ class _PlistParser:
# this is the root object
self.root = value
else:
- if not isinstance(self.stack[-1], type([])):
+ if not isinstance(self.stack[-1], list):
raise ValueError("unexpected element at line %d" %
self.parser.CurrentLineNumber)
self.stack[-1].append(value)
@@ -232,7 +232,7 @@ class _PlistParser:
self.stack.pop()
def end_key(self):
- if self.current_key or not isinstance(self.stack[-1], type({})):
+ if self.current_key or not isinstance(self.stack[-1], dict):
raise ValueError("unexpected key at line %d" %
self.parser.CurrentLineNumber)
self.current_key = self.get_data()