Alex Waygood <alex.wayg...@gmail.com> added the comment:
This same bug (where classmethod properties are accidentally called by other parts of Python) is also present for non-abstract class properties, and has the side effect of causing doctest.py to crash with a fairly incomprehensible `AttributeError`: Script: class Untestable: """ >>> Untestable.my_classmethod_property 'Oh no!' """ @classmethod @property def my_classmethod_property(cls): return 'Oh no!' if __name__ == '__main__': import doctest doctest.testmod() Output: Traceback (most recent call last): File "C:/Users/Alex/classmethod_properties_bug.py", line 13, in <module> doctest.testmod() File "C:\Users\Alex\.conda\envs\WebGame39\lib\doctest.py", line 1955, in testmod for test in finder.find(m, name, globs=globs, extraglobs=extraglobs): File "C:\Users\Alex\.conda\envs\WebGame39\lib\doctest.py", line 939, in find self._find(tests, obj, name, module, source_lines, globs, {}) File "C:\Users\Alex\.conda\envs\WebGame39\lib\doctest.py", line 1001, in _find self._find(tests, val, valname, module, source_lines, File "C:\Users\Alex\.conda\envs\WebGame39\lib\doctest.py", line 1028, in _find val = getattr(obj, valname).__func__ AttributeError: 'str' object has no attribute '__func__' ---------- nosy: +AlexWaygood Added file: https://bugs.python.org/file50218/classmethod_properties_bug.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44904> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com