mirror of
https://github.com/python/cpython.git
synced 2025-08-08 10:58:51 +00:00
[3.12] gh-112266: Remove (if defined)
part from __dict__
and __weakref__
docstrings (GH-112268) (#112270)
gh-112266: Remove `(if defined)` part from `__dict__` and `__weakref__` docstrings (GH-112268)
(cherry picked from commit f8129146ef
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
f521321ddf
commit
cf8c830755
3 changed files with 20 additions and 18 deletions
|
@ -40,8 +40,8 @@ class nonascii:
|
||||||
|
|
||||||
if test.support.HAVE_DOCSTRINGS:
|
if test.support.HAVE_DOCSTRINGS:
|
||||||
expected_data_docstrings = (
|
expected_data_docstrings = (
|
||||||
'dictionary for instance variables (if defined)',
|
'dictionary for instance variables',
|
||||||
'list of weak references to the object (if defined)',
|
'list of weak references to the object',
|
||||||
) * 2
|
) * 2
|
||||||
else:
|
else:
|
||||||
expected_data_docstrings = ('', '', '', '')
|
expected_data_docstrings = ('', '', '', '')
|
||||||
|
@ -105,10 +105,10 @@ CLASSES
|
||||||
| Data descriptors defined here:
|
| Data descriptors defined here:
|
||||||
|
|
|
|
||||||
| __dict__
|
| __dict__
|
||||||
| dictionary for instance variables (if defined)
|
| dictionary for instance variables
|
||||||
|
|
|
|
||||||
| __weakref__
|
| __weakref__
|
||||||
| list of weak references to the object (if defined)
|
| list of weak references to the object
|
||||||
|
|
||||||
FUNCTIONS
|
FUNCTIONS
|
||||||
doc_func()
|
doc_func()
|
||||||
|
@ -166,16 +166,16 @@ class A(builtins.object)
|
||||||
|
|
||||||
Data descriptors defined here:
|
Data descriptors defined here:
|
||||||
__dict__
|
__dict__
|
||||||
dictionary for instance variables (if defined)
|
dictionary for instance variables
|
||||||
__weakref__
|
__weakref__
|
||||||
list of weak references to the object (if defined)
|
list of weak references to the object
|
||||||
|
|
||||||
class B(builtins.object)
|
class B(builtins.object)
|
||||||
Data descriptors defined here:
|
Data descriptors defined here:
|
||||||
__dict__
|
__dict__
|
||||||
dictionary for instance variables (if defined)
|
dictionary for instance variables
|
||||||
__weakref__
|
__weakref__
|
||||||
list of weak references to the object (if defined)
|
list of weak references to the object
|
||||||
Data and other attributes defined here:
|
Data and other attributes defined here:
|
||||||
NO_MEANING = 'eggs'
|
NO_MEANING = 'eggs'
|
||||||
__annotations__ = {'NO_MEANING': <class 'str'>}
|
__annotations__ = {'NO_MEANING': <class 'str'>}
|
||||||
|
@ -192,9 +192,9 @@ class C(builtins.object)
|
||||||
__class_getitem__(item) from builtins.type
|
__class_getitem__(item) from builtins.type
|
||||||
Data descriptors defined here:
|
Data descriptors defined here:
|
||||||
__dict__
|
__dict__
|
||||||
dictionary for instance variables (if defined)
|
dictionary for instance variables
|
||||||
__weakref__
|
__weakref__
|
||||||
list of weak references to the object (if defined)
|
list of weak references to the object
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
doc_func()
|
doc_func()
|
||||||
|
@ -826,10 +826,10 @@ class B(A)
|
||||||
| Data descriptors inherited from A:
|
| Data descriptors inherited from A:
|
||||||
|
|
|
|
||||||
| __dict__
|
| __dict__
|
||||||
| dictionary for instance variables (if defined)
|
| dictionary for instance variables
|
||||||
|
|
|
|
||||||
| __weakref__
|
| __weakref__
|
||||||
| list of weak references to the object (if defined)
|
| list of weak references to the object
|
||||||
''' % __name__)
|
''' % __name__)
|
||||||
|
|
||||||
doc = pydoc.render_doc(B, renderer=pydoc.HTMLDoc())
|
doc = pydoc.render_doc(B, renderer=pydoc.HTMLDoc())
|
||||||
|
@ -858,9 +858,9 @@ class B(A)
|
||||||
|
|
||||||
Data descriptors inherited from A:
|
Data descriptors inherited from A:
|
||||||
__dict__
|
__dict__
|
||||||
dictionary for instance variables (if defined)
|
dictionary for instance variables
|
||||||
__weakref__
|
__weakref__
|
||||||
list of weak references to the object (if defined)
|
list of weak references to the object
|
||||||
"""
|
"""
|
||||||
as_text = html2text(doc)
|
as_text = html2text(doc)
|
||||||
expected_lines = [line.strip() for line in expected_text.split("\n") if line]
|
expected_lines = [line.strip() for line in expected_text.split("\n") if line]
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Change docstrings of :attr:`~object.__dict__` and
|
||||||
|
:attr:`~object.__weakref__`.
|
|
@ -2974,21 +2974,21 @@ subtype_getweakref(PyObject *obj, void *context)
|
||||||
|
|
||||||
static PyGetSetDef subtype_getsets_full[] = {
|
static PyGetSetDef subtype_getsets_full[] = {
|
||||||
{"__dict__", subtype_dict, subtype_setdict,
|
{"__dict__", subtype_dict, subtype_setdict,
|
||||||
PyDoc_STR("dictionary for instance variables (if defined)")},
|
PyDoc_STR("dictionary for instance variables")},
|
||||||
{"__weakref__", subtype_getweakref, NULL,
|
{"__weakref__", subtype_getweakref, NULL,
|
||||||
PyDoc_STR("list of weak references to the object (if defined)")},
|
PyDoc_STR("list of weak references to the object")},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyGetSetDef subtype_getsets_dict_only[] = {
|
static PyGetSetDef subtype_getsets_dict_only[] = {
|
||||||
{"__dict__", subtype_dict, subtype_setdict,
|
{"__dict__", subtype_dict, subtype_setdict,
|
||||||
PyDoc_STR("dictionary for instance variables (if defined)")},
|
PyDoc_STR("dictionary for instance variables")},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyGetSetDef subtype_getsets_weakref_only[] = {
|
static PyGetSetDef subtype_getsets_weakref_only[] = {
|
||||||
{"__weakref__", subtype_getweakref, NULL,
|
{"__weakref__", subtype_getweakref, NULL,
|
||||||
PyDoc_STR("list of weak references to the object (if defined)")},
|
PyDoc_STR("list of weak references to the object")},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue