classification
Title: __doc__ attribute is not set in property-derived classes
Type: Stage: patch review
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Sergei Izmailov, rhettinger, xtreak
Priority: normal Keywords: patch

Created on 2020-07-12 20:34 by Sergei Izmailov, last changed 2020-11-09 10:20 by Sergei Izmailov.

Pull Requests
URL Status Linked Edit
PR 23205 open Sergei Izmailov, 2020-11-09 10:20
Messages (3)
msg373571 - (view) Author: Sergei Izmailov (Sergei Izmailov) * Date: 2020-07-12 20:34
MRE: 

class Property(property):
    pass

print(Property(None, None, None, "hello").__doc__)

Expected: 
hello

Actual:
None
msg373624 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-07-14 05:31
What would you expect this to print?

class Property(property):
    'custom docstring'

print(Property(None, None, None, "hello").__doc__)
msg373627 - (view) Author: Sergei Izmailov (Sergei Izmailov) * Date: 2020-07-14 07:19
class Property(property):
    'custom docstring'

print(Property(None, None, None, "hello").__doc__)

This snippet is expected to print "hello" as well (at least it's what comment in cpython implementation suggests) 

https://github.com/python/cpython/blob/master/Objects/descrobject.c#L1712-L1715
History
Date User Action Args
2020-11-09 10:20:58Sergei Izmailovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request22103
2020-07-14 07:19:25Sergei Izmailovsetmessages: + msg373627
2020-07-14 05:31:33rhettingersetnosy: + rhettinger
messages: + msg373624
2020-07-13 02:21:14xtreaksetnosy: + xtreak
2020-07-12 20:34:43Sergei Izmailovcreate