This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Viktor Roytman, levkivskyi, lukasz.langa, ncoghlan, xtreak
Date 2020-02-19.05:36:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I guess the method checks for annotation on cls [0] which will be classmethod/staticmethod object in the report and won't have annotations. The annotations should be looked up in the function the classmethod/staticmethod decorator wraps around as in cls.__func__ . Something like below so that the right annotations are picked up. In addition to this the registry should store the type annotation as key to cls or cls.__func__ depending on normal method or classmethod/staticmethod.

diff --git Lib/ Lib/
index 050bec8605..a66711208d 100644
--- Lib/
+++ Lib/
@@ -1073,24 +1073,33 @@ def singledispatch(func):
         if func is None:
             if isinstance(cls, type):
                 return lambda f: register(cls, f)
-            ann = getattr(cls, '__annotations__', {})
+            if isinstance(cls, (classmethod, staticmethod)):
+                ann = getattr(cls.__func__, '__annotations__', {})
+                func = cls.__func__
+            else:
+                ann = getattr(cls, '__annotations__', {})
+                func = cls

Date User Action Args
2020-02-19 05:36:16xtreaksetrecipients: + xtreak, ncoghlan, lukasz.langa, levkivskyi, Viktor Roytman
2020-02-19 05:36:16xtreaksetmessageid: <>
2020-02-19 05:36:16xtreaklinkissue39679 messages
2020-02-19 05:36:16xtreakcreate