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 AlexWaygood
Recipients AlexWaygood, rzepecki.t
Date 2021-08-15.15:13:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629040413.99.0.951748156759.issue44904@roundup.psfhosted.org>
In-reply-to
Content
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__'
History
Date User Action Args
2021-08-15 15:13:34AlexWaygoodsetrecipients: + AlexWaygood, rzepecki.t
2021-08-15 15:13:33AlexWaygoodsetmessageid: <1629040413.99.0.951748156759.issue44904@roundup.psfhosted.org>
2021-08-15 15:13:33AlexWaygoodlinkissue44904 messages
2021-08-15 15:13:33AlexWaygoodcreate