8000 Special types' `__doc__` property should be readonly · Issue #2916 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content
Special types' __doc__ property should be readonly #2916
Open
@moreal

Description

@moreal

Feature

Special types' __doc__ property should be readonly (i.e. getter) except for user-defined type. But __doc__ properties of RustPython's special types is writable.

CPython

>>> SystemExit.__doc__
'Request to exit from the interpreter.'
>>> SystemExit.__doc__ = ""
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type 'SystemExit'
>>> class A:
...   ...
... 
>>> A.__doc__ = "123"
>>> A.__doc__
'123'

RustPython

>>>>> SystemExit.__doc__
'object()\n--\n\nThe base class of the class hierarchy.\n\nWhen called, it accepts no arguments and returns a new featureless\ninstance that has no instance attributes and cannot be given any.'
>>>>> SystemExit.__doc__ = ""
>>>>> class A:
.....   ...
..... 
>>>>> A.__doc__
>>>>> A.__doc__ = "123"
>>>>> A.__doc__
'123'

Python Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    z-ca-2021Tag to track contrubution-academy 2021

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0