Skip to content

Commit 9585ab5

Browse files
committed
Remove deepcopy for docstrings as it leads to a significant drop in performance
1 parent d83115d commit 9585ab5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mkdocstrings_handlers/python/rendering.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def _construct_docstring_according_to_strategy(name: str, obj: Object | Alias, s
390390
merge_delimiter: The delimiter to use when merging docstrings.
391391
392392
Returns:
393-
A new docstring object.
393+
A new docstring object that just contains the docstring content.
394394
"""
395395

396396
if strategy == DocstringInheritStrategy.default:
@@ -401,7 +401,7 @@ def _construct_docstring_according_to_strategy(name: str, obj: Object | Alias, s
401401
for parent in list(obj.mro()):
402402
# this traverses the parents in the order of the MRO, i.e. the first entry is the most direct parent
403403
if parent.members and name in parent.members and parent.members[name].docstring:
404-
return deepcopy(parent.members[name].docstring)
404+
return Docstring(value=parent.members[name].docstring.value)
405405
return None
406406

407407
if strategy == DocstringInheritStrategy.merge:

0 commit comments

Comments
 (0)