[Python-checkins] bpo-33534: Remove unneeded test. (GH-6897)

Miss Islington (bot) webhook-mailer at python.org
Wed May 16 07:46:40 EDT 2018


https://github.com/python/cpython/commit/8e20fc388f1f1e6b2b38bf11995322c274b4d43a
commit: 8e20fc388f1f1e6b2b38bf11995322c274b4d43a
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-05-16T04:46:32-07:00
summary:

bpo-33534: Remove unneeded test. (GH-6897)


This condition as already tested before this code is called.
(cherry picked from commit 9285835a05ad0319acef111340266c0f85ed549c)

Co-authored-by: Eric V. Smith <ericvsmith at users.noreply.github.com>

files:
M Lib/dataclasses.py

diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 480c6f74165b..bb77d3b4052b 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -544,12 +544,11 @@ def _hash_fn(fields):
 
 
 def _is_classvar(a_type, typing):
-    if typing:
-        # This test uses a typing internal class, but it's the best
-        # way to test if this is a ClassVar.
-        return (a_type is typing.ClassVar
-                or (type(a_type) is typing._GenericAlias
-                    and a_type.__origin__ is typing.ClassVar))
+    # This test uses a typing internal class, but it's the best way to
+    # test if this is a ClassVar.
+    return (a_type is typing.ClassVar
+            or (type(a_type) is typing._GenericAlias
+                and a_type.__origin__ is typing.ClassVar))
 
 
 def _is_initvar(a_type, dataclasses):



More information about the Python-checkins mailing list